From 2ca9e14f76916871b7ddb3f9c12674760c8d012c Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 27 Nov 2019 23:15:13 +0000 Subject: [PATCH] fix(core): update --- ts/lik.objectmap.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ts/lik.objectmap.ts b/ts/lik.objectmap.ts index 4c56a15..ee7db7a 100644 --- a/ts/lik.objectmap.ts +++ b/ts/lik.objectmap.ts @@ -14,6 +14,9 @@ export interface IObjectmapFindFunction { export class Objectmap { private objectArray: T[] = []; + // events + public eventSubject = new plugins.smartrx.rxjs.Subject(); + /** * returns a new instance */ @@ -33,6 +36,7 @@ export class Objectmap { } else { // the object is not yet in the objectmap this.objectArray.push(objectArg); + this.eventSubject.next('add'); return true; } } @@ -89,7 +93,9 @@ export class Objectmap { * gets an object in the Observablemap and removes it, so it can't be retrieved again */ public getOneAndRemove(): T { - return this.objectArray.shift(); + const removedItem = this.objectArray.shift(); + this.eventSubject.next('remove'); + return removedItem; } /** @@ -125,6 +131,7 @@ export class Objectmap { } } this.objectArray = replacementArray; + this.eventSubject.next('remove'); } /** @@ -132,5 +139,6 @@ export class Objectmap { */ public wipe() { this.objectArray = []; + this.eventSubject.next('wiped'); } }