Sandbox: Add setImmediate polyfill (#78093)

This commit is contained in:
Esteban Beltran 2023-11-14 10:40:58 +01:00 committed by GitHub
parent 26bcfe300f
commit b6d6375e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,9 @@ async function doImportPluginModuleInSandbox(meta: PluginMeta): Promise<System.M
// window.locationSandbox. In the future `window.location` could be a proxy if we
// want to intercept calls to it.
locationSandbox: window.location,
setImmediate: function (fn: Function, ...args: unknown[]) {
return setTimeout(fn, 0, ...args);
},
get monaco() {
// `window.monaco` may be undefined when invoked. However, plugins have long
// accessed it directly, aware of this possibility.