{"version":3,"file":"queueMicrotask.mjs","names":[],"sources":["../../src/tools/queueMicrotask.ts"],"sourcesContent":["import { monitor } from './monitor'\nimport { globalObject } from './globalObject'\n\nexport function queueMicrotask(callback: () => void) {\n  // Intentionally avoid .bind(globalObject): in some environments (e.g. Selenium GeckoDriver's\n  // executeScript), globalThis is not a proper global object, so calling the bound function throws\n  // 'queueMicrotask called on an object that does not implement interface Window'. Calling it as an\n  // unbound method is fine, as the proper global object will be used implicitly.\n  // See https://github.com/mozilla/geckodriver/issues/1798\n  const nativeImplementation = globalObject.queueMicrotask\n\n  if (typeof nativeImplementation === 'function') {\n    nativeImplementation(monitor(callback))\n  } else {\n    // eslint-disable-next-line @typescript-eslint/no-floating-promises -- the callback is monitored, so it'll never throw\n    Promise.resolve().then(monitor(callback))\n  }\n}\n"],"mappings":";;;AAGA,SAAgB,eAAe,UAAsB;CAMnD,MAAM,uBAAuB,aAAa;CAE1C,IAAI,OAAO,yBAAyB,YAClC,qBAAqB,QAAQ,QAAQ,CAAC;MAGtC,QAAQ,QAAQ,CAAC,CAAC,KAAK,QAAQ,QAAQ,CAAC;AAE5C"}