MCPcopy Create free account
hub / github.com/getsentry/sentry / scheduleMicroTask

Function scheduleMicroTask

static/app/utils/scheduleMicroTask.ts:3–21  ·  view source on GitHub ↗
(callback: () => void)

Source from the content-addressed store, hash-verified

1const SUPPORTS_QUEUE_MICROTASK = window && 'queueMicrotask' in window;
2
3export function scheduleMicroTask(callback: () => void) {
4 if (SUPPORTS_QUEUE_MICROTASK) {
5 window.queueMicrotask(callback);
6 } else {
7 Promise.resolve()
8 .then(callback)
9 .catch(e => {
10 // Escape the promise and throw the error so it gets reported
11 if (window) {
12 window.setTimeout(() => {
13 throw e;
14 });
15 } else {
16 // Best effort and just rethrow
17 throw e;
18 }
19 });
20 }
21}

Callers 4

CompactSelectFunction · 0.90
useLocalStorageStateFunction · 0.90
DashboardInnerFunction · 0.90
DashboardDetailClass · 0.90

Calls 3

catchMethod · 0.80
thenMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected