ko-contrib-fns
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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'

/ko-contrib-fns/

    Package Sidebar

    Install

    npm i ko-contrib-fns

    Weekly Downloads

    1

    Version

    0.0.5

    License

    WTFPL

    Last publish

    Collaborators

    • caseywebb