Skip to content

Commit

Permalink
Added some JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
duart38 committed Jul 30, 2020
1 parent 19aec60 commit afdd6d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export default class Observe<T> {
this.history.push(defaultValue);
}

/**
* Gets the last added value
*/
public getValue(): T {
return this.history[this.history.length - 1];
}
Expand Down Expand Up @@ -69,6 +72,10 @@ export default class Observe<T> {
this.setValue(this.getHistory()[0]);
}

/**
* Dispatches events to listeners
* @param value The value to dispatch
*/
private emit(value: T) {
this.currentEvent = new CustomEvent<T>(this.eventID, { detail: value });
const success = dispatchEvent(this.currentEvent);
Expand Down

0 comments on commit afdd6d1

Please sign in to comment.