1.0.1 • Published 4 years ago
simply-observable v1.0.1
Simply Observable
This is a really simplified version of the RXJS observable class. It does not do anything more than notifying the subscribed functions when an event occurs somewhere.
API
Importing
import {SimpleObservable} from "simply-observable";
Constructor
let myObservable = new SimpleObservable<T>();
Subscribing to the observable
myObservable.subscribe((payload: T) => {
console.log(payload);
});
Unsubscribing
myObservable.unsubscribe(subscriberFunction);
Notifying the subscribed functions with a payload value
myObservable.next("Hello world!");