MCPcopy Index your code
hub / github.com/microsoft/SandDance / safeSetTimeout

Function safeSetTimeout

docs/app/js/sanddance-app.js:25830–25849  ·  view source on GitHub ↗
(component)

Source from the content-addressed store, hash-verified

25828parcelHelpers.export(exports, "safeSetTimeout", ()=>safeSetTimeout);
25829var _extendComponent = require("./extendComponent");
25830var safeSetTimeout = function(component) {
25831 var activeTimeouts;
25832 return function(cb, duration) {
25833 if (!activeTimeouts) {
25834 activeTimeouts = new Set();
25835 (0, _extendComponent.extendComponent)(component, {
25836 componentWillUnmount: function() {
25837 activeTimeouts.forEach(function(id) {
25838 return clearTimeout(id);
25839 });
25840 }
25841 });
25842 }
25843 var timeoutId = setTimeout(function() {
25844 activeTimeouts.delete(timeoutId);
25845 cb();
25846 }, duration);
25847 activeTimeouts.add(timeoutId);
25848 };
25849};
25850
25851},{"./extendComponent":"4VCg2","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"7yIRz":[function(require,module,exports) {
25852var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 3

forEachMethod · 0.45
deleteMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected