preload string (可选) -在页面运行其他脚本之前预先加载指定的脚本 无论页面是否集成Node, 此脚本都可以访问所有Node API 脚本路径为文件的绝对路径。 当 node integration 关闭时, 预加载的脚本将从全局范围重新引入node的全局引用标志 See example here.
sandbox boolean (可选)-如果设置该参数, 沙箱的渲染器将与窗口关联, 使它与Chromium OS-level 的沙箱兼容, 并禁用 Node. js 引擎。 它与 nodeIntegration 的选项不同,且预加载脚本的 API 也有限制. Default is true since Electron 20. The sandbox will automatically be disabled when nodeIntegration is set to true. Read more about the option here.
sessionSession (optional) - Sets the session used by the page. 而不是直接忽略 Session 对象, 也可用 partition 选项来代替,它接受一个 partition 字符串. 同时设置了session 和 partition时, session 的优先级更高. 默认使用默认的 session.
backgroundThrottlingboolean (可选)-是否在页面成为背景时限制动画和计时器。 This also affects the Page Visibility API. When at least one webContents displayed in a single browserWindow has disabled backgroundThrottling then frames will be drawn and swapped for the whole window and other webContents displayed by it. 默认值为 true。
offscreen Object | boolean (optional) - Whether to enable offscreen rendering for the browser window. 默认值为 false. See the offscreen rendering tutorial for more details.
useSharedTexture boolean (optional) Experimental - Whether to use GPU shared texture for accelerated paint event. 默认值为 false. See the offscreen rendering tutorial for more details.
sharedTexturePixelFormat string (optional) Experimental - The requested output format of the shared texture. 默认值为:argb。 The name is originated from Chromium media::VideoPixelFormat enum suffix and only subset of them are supported. The actual output pixel format and color space of the texture should refer to OffscreenSharedTexture object in the paint event.
argb - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
rgbaf16 - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
contextIsolation boolean (可选) - 是否在独立 JavaScript 环境中运行 Electron API和指定的preload 脚本. 默认为 true。 预加载脚本所运行的上下文环境只能访问其自身专用的文档和全局窗口,其自身一系列内置的JavaScript (Array, Object, JSON, 等等) 也是如此,这些对于已加载的内容都是不可见的。 Electron API 将只在预加载脚本中可用,在已加载页面中不可用。 这个选项应被用于加载可能不被信任的远程内容时来确保加载的内容无法篡改预加载脚本和任何正在使用的Electron api。 该选项使用的是与Chrome内容脚本相同的技术。 你可以在开发者工具Console选项卡内顶部组合框中选择 'Electron Isolated Context'条目来访问这个上下文。
webviewTag boolean (optional) - Whether to enable the <webview> tag. 默认值为 false. ** 注意: **为 < webview> 配置的 preload 脚本在执行时将启用节点集成, 因此应确保远程或不受信任的内容无法创建恶意的 preload 脚本 。 You can use the will-attach-webview event on webContents to strip away the preload script and to validate or alter the <webview>'s initial settings.
transparent boolean (optional) - Whether to enable background transparency for the guest page. 默认值为 true。 Note: The guest page's text and background colors are derived from the color scheme of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
enableDeprecatedPaste boolean (optional) Deprecated - Whether to enable the pasteexecCommand. 默认值为 false.