0.0.5 • Published 7 years ago

ko-contrib-fns v0.0.5

Weekly downloads
2
License
WTFPL
Repository
github
Last release
7 years ago

ko-contrib-fns

NPM Version WTFPL Travis Coverage Status Dependency Status Peer Dependency Status

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'