Defer calls
Defer calls to an object's method, then executes them all when you give the signal
Install
npm i defer-calls
Use
var deferMethod = require('defer-calls').method;
var guy = {
sayHello: function(name) {
return 'Hello ' + name;
}
};
guy.sayHello('you');
var helloWaiting = deferMethod(guy, 'sayHello', function (name) {
return 'Wait ' + name;
});
guy.sayHello('world');
guy.sayHello('everyone');
helloWaiting.callsList;
helloWaiting.execAll()
helloWaiting.execAll();
helloWaiting.callsList;
guy.sayHello('Kitty');
TODO
Equivalent for a function instead of a method.
LICENCE
MIT