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 = method; var guy = { return 'Hello ' + name; }; guy; // => 'Hello you' var helloWaiting = ;// The 3rd arg is the temporary behavior, if you just want to return a value,// you can pass this value instead of a function. // Hold it...guy; // => 'Wait world'guy; // => 'Wait everyone' helloWaitingcallsList; // => [['world'], ['everyone']];// WARNING : ['world'] and ['everyone'] are "arguments arrays" i.e. not real Arrays// See here : https://developer.mozilla.org/docs/Web/JavaScript/Reference/Fonctions/arguments // Then give the signal!helloWaiting // => ['Hello world', 'Hello everyone'] // After that...helloWaiting; // NoophelloWaitingcallsList; // [] // Everything is back to normalguy; // => 'Hello Kitty'
TODO
Equivalent for a function instead of a method.
LICENCE
MIT