observ
A observable value representation
Example
var Observable = var v = v var curr = assert
dominictarr/observable
?
What about Both observ
& observable
have the same interface of
thing()
gets the valuething.set(...)
sets the valuething(function (value) { ... })
listens to the value.
The way observ
and observable
differ is in listening.
observ
will ONLY call the listener if.set()
is invoked.observable
calls the listener IMMEDIATELY and calls it whenever.set()
is invoked
observ
can be used in a similar fashion to observable
by using
var watch = require("observ/watch")
. You can then just
watch(thing, function (value) { ... })
and it will call the
listener immediately
Both observ
& observable
have a computed method with the same
interface.
require("observable").compute
require("observ/computed")
Example computed
var Observable = var computed = var one = var two = var together = asserttwoassert
Docs
type Observable<A> := { () => A & (Function<A>) => void, set: (A) => void} observ := (A) => Observable<A>
Installation
npm install observ
Contributors
- Raynos