27 lines
2.0 KiB
JavaScript
27 lines
2.0 KiB
JavaScript
"use strict";
|
|
const plugins = require("./lik.plugins");
|
|
const lik_objectmap_1 = require("./lik.objectmap");
|
|
class Observablemap {
|
|
constructor() {
|
|
this.ObservableEmitterBundleObjectmap = new lik_objectmap_1.Objectmap();
|
|
}
|
|
getObservableForEmitterEvent(emitterArg, eventArg) {
|
|
let existingBundle = this.ObservableEmitterBundleObjectmap.find((bundleArg) => {
|
|
return (bundleArg.emitter === emitterArg && bundleArg.event === eventArg);
|
|
});
|
|
if (existingBundle) {
|
|
return existingBundle.observable;
|
|
}
|
|
else {
|
|
let emitterObservable = plugins.rx.Observable.fromEvent(emitterArg, eventArg);
|
|
this.ObservableEmitterBundleObjectmap.add({
|
|
observable: emitterObservable,
|
|
emitter: emitterArg,
|
|
event: eventArg
|
|
});
|
|
return emitterObservable;
|
|
}
|
|
}
|
|
}
|
|
exports.Observablemap = Observablemap;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9ic2VydmFibGVtYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9saWsub2JzZXJ2YWJsZW1hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEseUNBQXdDO0FBQ3hDLG1EQUEyQztBQWMzQztJQUFBO1FBQ0kscUNBQWdDLEdBQUcsSUFBSSx5QkFBUyxFQUEyQixDQUFBO0lBa0IvRSxDQUFDO0lBaEJHLDRCQUE0QixDQUFDLFVBQXVDLEVBQUUsUUFBZ0I7UUFDbEYsSUFBSSxjQUFjLEdBQUcsSUFBSSxDQUFDLGdDQUFnQyxDQUFDLElBQUksQ0FBQyxDQUFDLFNBQVM7WUFDdEUsTUFBTSxDQUFBLENBQUMsU0FBUyxDQUFDLE9BQU8sS0FBSyxVQUFVLElBQUksU0FBUyxDQUFDLEtBQUssS0FBSyxRQUFRLENBQUMsQ0FBQTtRQUM1RSxDQUF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