observ-thunk

1.0.0 • Public • Published

observ-thunk Build Status

Wrap a listener to prevent multiple calls for identical values

Install

$ npm install --save observ-thunk

Usage

var ObservThunk = require('observ-thunk')
var Observ = require('observ')
var observable = Observ()

observable(ObservThunk(function (value) {
  console.log(value)  
}))

observable.set(1)
observable.set(1)
observable.set(1)

//=> 1 (printed only once)

API

ObservThunk(fn) -> function

fn

Required
Type: function

A function to run when the obserable's value is not strictly equal to the previous call.

License

MIT © Ben Drucker

Readme

Keywords

Package Sidebar

Install

npm i observ-thunk

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker