š» valoo
just the bare necessities of state management.
Usage
Hotlink it from https://unpkg.com/valoo
.
Ā //Ā createĀ anĀ observableĀ value:constĀ numĀ =Ā Ā //Ā subscribeĀ toĀ valueĀ changes:constĀ offĀ =Ā numĀ //Ā unsubscribeĀ thatĀ listener:Ā //Ā setĀ theĀ value,Ā invokingĀ anyĀ listeners:Ā //Ā getĀ theĀ currentĀ value:Ā Ā //Ā 43
Other Versions
valoo-lite.mjs
: lighter 120b version, but doesn't support unsubscribing.valoo-original.mjs
: v1-compatible, with subscribe handled via overloading.
Credit
The idea here was first implemented in Mithril. I believe the subscription mechanism is new though.
License
Apache-2.0. Copyright 2018 Google LLC.