1.0.0-alpha.8 • Published 6 years ago

@profiscience/knockout-contrib-observable-fn-subscribe-once v1.0.0-alpha.8

Weekly downloads
1
License
WTFPL
Repository
github
Last release
6 years ago

@profiscience/knockout-contrib-observable-fn-subscribe-once

Version Dependency Status Peer Dependency Status Dev Dependency Status Downloads

NOTE: It is recommended to use the @profiscience/knockout-contrib-observable-fn metapackage

Creates a subscription that is called once and then disposed.

Usage

observable.fn.subscribeOnce(fn: (newValue: T) => void)

import '@profiscience/knockout-contrib-observable-fn/subscribeOnce'

const foo = ko.observable(0)

foo.subscribeOnce(() => console.log('hit!'))

foo(1)
// hit!

foo(2)
// nothing...