Optional
destroyer: (() => void)Private
Optional
Readonly
_destroyerProtected
_listenersPrivate
_valueSet the value, and dispatch to all listeners.
Add a listener for when this Consumable changes.
Set's the new value, and calls all the listeners. You can additionaly set the value directly.
Create a new Consumable that intersects this Consumable. The new Consumable updates its value based on this Consumable.
const value = createConsumable(2);
const isGreater = value.intersect((value) => value > 5);
// > isGreater == false;
value.dispatch(6);
// > isGreater == true;
Remove a listener for when this Consumable changes.
Generated using TypeDoc
A class that holds a value. Listeners can be attached and whenever a new value is dispatched, the listeners are called.
See
https://github.com/nombrekeff/cardboard-js/wiki/Consumables