@profiscience/knockout-contrib-utils-once
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

utils.once

Version Dependency Status Peer Dependency Status Dev Dependency Status Downloads

This package is intended for consumption via the [@profiscience/knockout-contrib] metapackage

Creates a subscription that is called once and then disposed. Returns subscription for early disposal if necessary.

Usage

import { once } from '@profiscience/knockout-contrib'

const foo = ko.observable(0)

const sub = once(foo, () => console.log('hit!'))

foo(1)
// hit!

foo(2)
// nothing...

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @profiscience/knockout-contrib-utils-once

    Weekly Downloads

    2

    Version

    2.0.1

    License

    WTFPL

    Unpacked Size

    7.75 kB

    Total Files

    12

    Last publish

    Collaborators

    • dorgeron
    • barsh