可以通过以下命令来安装最新版本:
npm install electron@latest
protocol.register*Protocol 和 protocol.intercept*Protocol 方法已被 protocol.handle 取代。
新方法可以注册新协议或拦截现有协议,响应可以是任何类型。
// Electron 25 中已弃用:protocol.registerBufferProtocol('some-protocol', () => { callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') });});// 使用以下方式代替:protocol.handle('some-protocol', () => { return new Response( Buffer.from('<h5>Response</h5>'), // 可以是字符串或 ReadableStream。 { headers: { 'content-type': 'text/html' } } );});
// Electron 25 中已弃用:protocol.registerHttpProtocol('some-protocol', () => { callback({ url: 'https://electronjs.org' });});// 使用以下方式代替:protocol.handle('some-protocol', () => { return net.fetch('https://electronjs.org');});
// Electron 25 中已弃用:protocol.registerFileProtocol('some-protocol', () => { callback({ filePath: '/path/to/my/file' });});// 使用以下方式代替:protocol.handle('some-protocol', () => { return net.fetch('file:///path/to/my/file');});
BrowserWindow.setTrafficLightPosition(position) 已被弃用,应改用 BrowserWindow.setWindowButtonPosition(position) API,它接受 null 而不是 { x: 0, y: 0 } 以将位置重置为系统默认值。
// Electron 25 中已弃用:win.setTrafficLightPosition({ x: 10, y: 10 });win.setTrafficLightPosition({ x: 0, y: 0 });// 使用以下方式代替:win.setWindowButtonPosition({ x: 10, y: 10 });win.setWindowButtonPosition(null);
BrowserWindow.getTrafficLightPosition() 已被弃用,应改用 BrowserWindow.getWindowButtonPosition() API,当没有自定义位置时,它返回 null 而不是 { x: 0, y: 0 }。
// Electron 25 中已弃用:const pos = win.getTrafficLightPosition();if (pos.x === 0 && pos.y === 0) { // No custom position.}// 使用以下方式代替:const ret = win.getWindowButtonPosition();if (ret === null) { // 没有自定义位置}
Electron 22 (Chromium 108) 的计划生命周期结束日期将从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日。Electron 团队将继续向后移植任何安全修复到 Electron 22 中,直到 2023 年 10 月 10 日。10 月 11 日,Electron 团队将支持回到最新的三个稳定主要版本,将不再支持 Windows 7/8/8.1。
责任编辑:武晓燕 来源: 前端充电宝 Electron版本安全参考:https://www.electronjs.org/blog/electron-25-0
(责任编辑:知识)
银保监会:前10个月房地产合理贷款需求得到满足 信贷结构持续优化