diff options
author | Benjamin Pasero <benjamin.pasero@microsoft.com> | 2021-04-01 10:09:05 +0300 |
---|---|---|
committer | Benjamin Pasero <benjamin.pasero@microsoft.com> | 2021-04-01 10:09:05 +0300 |
commit | 2dab9c80c1e147474c53b2bec7df67634223eda4 (patch) | |
tree | 6ef23f1d60e073fad85ecfbd3338d6d51b23444e /src/bootstrap-window.js | |
parent | 1db94dbb102fa85d65f4ef4c0ad2a9b913e3c644 (diff) |
bootstrap - some more cleanup around types
Diffstat (limited to 'src/bootstrap-window.js')
-rw-r--r-- | src/bootstrap-window.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index a08e7b668ff..eb10108abb0 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -34,11 +34,9 @@ * @param {string[]} modulePaths * @param {(result: unknown, configuration: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => Promise<unknown> | undefined} resultCallback * @param {{ - * forceEnableDeveloperKeybindings?: boolean, - * disallowReloadKeybinding?: boolean, - * removeDeveloperKeybindingsAfterLoad?: boolean, + * configureDeveloperKeybindings?: (config: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean}, * canModifyDOM?: (config: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => void, - * beforeLoaderConfig?: (config: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration, loaderConfig: object) => void, + * beforeLoaderConfig?: (loaderConfig: object) => void, * beforeRequire?: () => void * }} [options] */ @@ -55,11 +53,12 @@ const configuration = await preloadGlobals.context.configuration; performance.mark('code/didWaitForWindowConfig'); - // Developer tools - const enableDeveloperKeybindings = safeProcess.env['VSCODE_DEV'] || configuration.forceEnableDeveloperKeybindings || options?.forceEnableDeveloperKeybindings; + // Developer keybindings + const { forceEnableDeveloperKeybindings, disallowReloadKeybinding, removeDeveloperKeybindingsAfterLoad } = typeof options?.configureDeveloperKeybindings === 'function' ? options.configureDeveloperKeybindings(configuration) : { forceEnableDeveloperKeybindings: false, disallowReloadKeybinding: false, removeDeveloperKeybindingsAfterLoad: false }; + const enableDeveloperKeybindings = safeProcess.env['VSCODE_DEV'] || forceEnableDeveloperKeybindings; let developerDeveloperKeybindingsDisposable; if (enableDeveloperKeybindings) { - developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(options?.disallowReloadKeybinding); + developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding); } // Enable ASAR support @@ -143,7 +142,7 @@ // Signal before require.config() if (typeof options?.beforeLoaderConfig === 'function') { - options.beforeLoaderConfig(configuration, loaderConfig); + options.beforeLoaderConfig(loaderConfig); } // Configure loader @@ -177,7 +176,7 @@ if (callbackResult instanceof Promise) { await callbackResult; - if (developerDeveloperKeybindingsDisposable && options?.removeDeveloperKeybindingsAfterLoad) { + if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) { developerDeveloperKeybindingsDisposable(); } } @@ -267,7 +266,6 @@ } return { - load, - globals + load }; })); |