Invoke a function that is expensive to execute (computation, database queries, etc) in a delay. This module creates a new function (the invoker) that wraps your function. Calling the invoker multiple times during the delay only executes your function once. This is especially useful for slowly updating state, based on rapid changes by the user.
npm install lazy-timer --save
To use this module in the browser, try browserify
var lazyTimer = ;var invoker =;;;;;// Will result in a single line:// Foo!
This module is very useful for slowly updating state, based on rapid changes by the user:
var mySearchField = document;var mySearchResults = document;// true as the second argument indicates the given callback is asynchronousvar invoker =;mySearchField;
Optionally, you can specify the
this object and
var lazyTimer = ;var myThisObject = foo: 'bar';var invoker =;;;;;// Will result in a single line:// bar 579