A clear API for function binding helpers.
$ component install ianstormtaylor/bind
$ npm install ianstormtaylor/bind
var bind = require('bind');
var object = {
one: function(){},
two: function(){}
};
// bind a single method
object.one = bind(object, object.one);
// bind certain methods
bind.methods(object, 'one', 'two');
// bind all methods
bind.all(object);
Bind a function
to always be called with the object
as context.
Bind all methods on an object
to always be called with the object
as context.
Bind certain methods
on object
to always be called with the object
as context.
MIT