consto = observable(stream=> { // Code to run for initialisation when we go from idle to at least one subscriber // Won't run again for additional subscribers, but WILL run again if we lose // all subscribers and then get one
// To send a value: stream.set(someValue);
// Optional: return function to call when all subscribers are removed return () => { // Code to run when all subscribers are removed } });
Creates a RxJs style observable
For example: