Musique/node_modules/async.util.onlyonce/index.js

10 lines
219 B
JavaScript
Raw Normal View History

'use strict';
module.exports = function only_once(fn) {
return function() {
if (fn === null) throw new Error('Callback was already called.');
fn.apply(this, arguments);
fn = null;
};
};