MCPcopy Create free account
hub / github.com/microsoft/SandDance / wrapped

Function wrapped

docs/external/js/react.development.js:3005–3048  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3003 var hasRun = false;
3004
3005 function wrapped() {
3006 var prevInteractions = interactionsRef.current;
3007 interactionsRef.current = wrappedInteractions;
3008 subscriber = subscriberRef.current;
3009
3010 try {
3011 var returnValue;
3012
3013 try {
3014 if (subscriber !== null) {
3015 subscriber.onWorkStarted(wrappedInteractions, threadID);
3016 }
3017 } finally {
3018 try {
3019 returnValue = callback.apply(undefined, arguments);
3020 } finally {
3021 interactionsRef.current = prevInteractions;
3022
3023 if (subscriber !== null) {
3024 subscriber.onWorkStopped(wrappedInteractions, threadID);
3025 }
3026 }
3027 }
3028
3029 return returnValue;
3030 } finally {
3031 if (!hasRun) {
3032 // We only expect a wrapped function to be executed once,
3033 // But in the event that it's executed more than once–
3034 // Only decrement the outstanding interaction counts once.
3035 hasRun = true; // Update pending async counts for all wrapped interactions.
3036 // If this was the last scheduled async work for any of them,
3037 // Mark them as completed.
3038
3039 wrappedInteractions.forEach(function (interaction) {
3040 interaction.__count--;
3041
3042 if (subscriber !== null && interaction.__count === 0) {
3043 subscriber.onInteractionScheduledWorkCompleted(interaction);
3044 }
3045 });
3046 }
3047 }
3048 }
3049
3050 wrapped.cancel = function cancel() {
3051 subscriber = subscriberRef.current;

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected