Cancelable functions for JavaScript.
Install the module with: npm install cancelable
var Cancelable = require('cancelable');
var fn = Cancelable(function(){console.log('plop');});
fn(); // print "plop"
fn.cancel();
fn(); // do nothing
Cancelable is compatible with Underscore and Lodash as a mixin.
var _ = require('underscore');
_.mixin(require('cancelable').exports());
var fn = _.cancelable(function(){console.log('plop');});
fn(); // print "plop"
fn.cancel();
fn(); // do nothing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
v0.1.0 3/17/2013 Initial release.
Copyright (c) 2013 Francois-Guillaume Ribreau Licensed under the MIT license.