An open API service indexing awesome lists of open source software.

https://github.com/shellscape/once-and-again

Resettable _.once()
https://github.com/shellscape/once-and-again

Last synced: 5 months ago
JSON representation

Resettable _.once()

Awesome Lists containing this project

README

          

once-and-again
==============

Resettable _.once()

Overrides _.prototype.once to return a function which accepts an argument to force a reset on the function, letting it run again. To reset the function:

var runOnceFunction = _(function () {
console.log('only run once');
}).once();

var initialResult = runOnceFunction(); // true result
var memoResult = runOnceFunction(); // memoized result, function not run
var newResult = runOnceFunction(true); // true result