diff --git a/Observe.ts b/Observe.ts index 6a044e6..768df10 100644 --- a/Observe.ts +++ b/Observe.ts @@ -16,6 +16,9 @@ export default class Observe { this.history.push(defaultValue); } + /** + * Gets the last added value + */ public getValue(): T { return this.history[this.history.length - 1]; } @@ -69,6 +72,10 @@ export default class Observe { this.setValue(this.getHistory()[0]); } + /** + * Dispatches events to listeners + * @param value The value to dispatch + */ private emit(value: T) { this.currentEvent = new CustomEvent(this.eventID, { detail: value }); const success = dispatchEvent(this.currentEvent);