monogamy
Lock a function until a provided unlock
function is called. If a callback is provided, the callback will assume the roll of the unlock
function. Supports CommonJS/AMD/VanillaJS.
The returned wrapped function provides a locked
property so that you can test if a function is locked.
Install
npm
npm install monogamy
bower
bower install monogamy
Example
var lock = ;var $ = ; // Prevent fetching of pi from the server until the first// request finishes.var onClick = ; ;
Contrived example
var lock = ;var fs = ; var write = ; ; console;// true