ko-contrib-fns
v0.0.5
Published
Knockout JS Observable Functions
Downloads
3
Maintainers
Readme
ko-contrib-fns
Table of Contents
observable.fn.increment/decrement([n = 1])
increments/decrements numeric observables.
import 'ko-contrib-fns/increment'
const foo = ko.observable(0)
foo.increment()
foo.increment(3)
foo.decrement()
foo.decrement(2)
foo()
// 1
observable.fn.subscribeOnce(fn)
Creates a subscription that is called once and then disposed.
import 'ko-contrib-fns/subscribeOnce'
const foo = ko.observable(0)
foo.subscribeOnce(() => console.log('hit!'))
foo(1)
// hit!
foo(2)
// nothing...
observable.fn.toString()
Make debugging in the console much nicer; you won't ever need to actually call this.
import 'ko-contrib-fns/toString'