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