Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: deprecates EventEmitter and replaces it with Subject #1517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JsantosDK
Copy link

Closes #1513

@JsantosDK
Copy link
Author

JsantosDK commented Jan 16, 2025

@CodeAndWeb PR should be done, and no issue that I can see with the replacement.
Could you please have a look and merge if all is ok?

Something that I also noted, and wanted to be more aware.
Right now, the subjects/event emitters are directly exposed by the service.
This means that the consuming app can do:

this.translateService.onDefaultLangChange.emit({ lang: 'foo', translations: ''})

For me, this seems like an error.
Wouldn't it be better to expose these has observables to the outside, and replace with the following:

private readonly _onDefaultLangChange:  Subject<DefaultLangChangeEvent>;
public readonly onDefaultLangChange: Observable<DefaultLangChangeEvent>;

constructor(...) {
  ...
 this._onDefaultLangChange = this.store.onDefaultLangChange;
 this.onDefaultLangChange = this._onDefaultLangChange.asObservable();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate EventEmitter
1 participant