@f/observable

1.2.0 • Public • Published

observable

Build status Git tag NPM version Code style

Minimal observable. DOES NOT ADHERE TO ES7 OBSERVABLE SPEC.

Installation

$ npm install @f/observable

Usage

var observable = require('@f/observable')

var o = observable()
o.subscribe(function (next) {
  console.log(next)
}) // => 1 , 2
o(1)
o(2)

API

observable()

Returns: observable

obs.subscribe(listener)

  • listener - add listener with signature listener(nextVal)

Returns: unsubscribe function

(val) - obs(val)

  • val - next value to send to listeners

() - obs()

Returns: Current value of the observable

License

MIT

/@f/observable/

    Package Sidebar

    Install

    npm i @f/observable

    Weekly Downloads

    4

    Version

    1.2.0

    License

    MIT

    Last publish

    Collaborators

    • f