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

Function safeRequestAnimationFrame

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

Source from the content-addressed store, hash-verified

25802parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>safeRequestAnimationFrame);
25803var _extendComponent = require("./extendComponent");
25804var safeRequestAnimationFrame = function(component) {
25805 var activeTimeouts;
25806 return function(cb) {
25807 if (!activeTimeouts) {
25808 activeTimeouts = new Set();
25809 (0, _extendComponent.extendComponent)(component, {
25810 componentWillUnmount: function() {
25811 activeTimeouts.forEach(function(id) {
25812 return cancelAnimationFrame(id);
25813 });
25814 }
25815 });
25816 }
25817 var timeoutId = requestAnimationFrame(function() {
25818 activeTimeouts.delete(timeoutId);
25819 cb();
25820 });
25821 activeTimeouts.add(timeoutId);
25822 };
25823};
25824
25825},{"./extendComponent":"4VCg2","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"gvcyc":[function(require,module,exports) {
25826var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 5

cancelAnimationFrameFunction · 0.70
requestAnimationFrameFunction · 0.70
forEachMethod · 0.45
deleteMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected