fix(core): update
This commit is contained in:
parent
d92123dcb9
commit
d389d180e5
@ -22,7 +22,6 @@
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^5.0.1",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"rxjs": "^7.5.2"
|
||||
},
|
||||
|
@ -18,21 +18,21 @@ export interface IObservableEmitterBundle {
|
||||
* manages observables by making sure that only one observable is regsitered per event
|
||||
*/
|
||||
export class Observablemap {
|
||||
public observableEmitterBundleObjectmap = new plugins.lik.ObjectMap<IObservableEmitterBundle>();
|
||||
public observableEmitterBundleArray = new Array<IObservableEmitterBundle>();
|
||||
|
||||
/**
|
||||
* creates a new observable if not yet registered for the same event.
|
||||
* In case event has been registered before the same observable is returned.
|
||||
*/
|
||||
public getObservableForEmitterEvent<T>(emitterArg: IEventEmitter<T>, eventArg: string) {
|
||||
const existingBundle = this.observableEmitterBundleObjectmap.findSync((bundleArg) => {
|
||||
const existingBundle = this.observableEmitterBundleArray.find((bundleArg) => {
|
||||
return bundleArg.emitter === emitterArg && bundleArg.event === eventArg;
|
||||
});
|
||||
if (existingBundle) {
|
||||
return existingBundle.observable;
|
||||
} else {
|
||||
const emitterObservable = rxjs.fromEvent<T>(emitterArg as any, eventArg);
|
||||
this.observableEmitterBundleObjectmap.add({
|
||||
this.observableEmitterBundleArray.push({
|
||||
observable: emitterObservable,
|
||||
emitter: emitterArg,
|
||||
event: eventArg,
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export { lik, smartpromise };
|
||||
export { smartpromise };
|
||||
|
Loading…
Reference in New Issue
Block a user