MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / only_once

Function only_once

public/javascripts/async.js:41–47  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

39 };
40
41 function only_once(fn) {
42 return function() {
43 if (fn === null) throw new Error("Callback was already called.");
44 fn.apply(this, arguments);
45 fn = null;
46 };
47 }
48
49 function _once(fn) {
50 return function() {

Callers 4

async.jsFile · 0.85
iterateFunction · 0.85
_eachOfLimitFunction · 0.85
_queueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected