首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

计划中的API更改 | Planned Breaking API Changes

以下列表包括将在Electron 2.0中删除的API。

没有时间表,何时会发布此版本,但至少会在90天前添加弃用警告。

app

代码语言:javascript
复制
// Deprecated
app.getAppMemoryInfo()
// Replace with
app.getAppMetrics()

BrowserWindow

代码语言:javascript
复制
// Deprecated
let optionsA = {webPreferences: {blinkFeatures: ''}}
let windowA = new BrowserWindow(optionsA)
// Replace with
let optionsB = {webPreferences: {enableBlinkFeatures: ''}}
let windowB = new BrowserWindow(optionsB)
代码语言:javascript
复制
// Deprecated
let optionsA = {titleBarStyle: 'hidden-inset'}
let windowA = new BrowserWindow(optionsA)
// Replace with
let optionsB = {titleBarStyle: 'hiddenInset'}
let windowB = new BrowserWindow(optionsB)

clipboard

代码语言:javascript
复制
// Deprecated
clipboard.readRtf()
// Replace with
clipboard.readRTF()

// Deprecated
clipboard.writeRtf()
// Replace with
clipboard.writeRTF()

// Deprecated
clipboard.readHtml()
// Replace with
clipboard.readHTML()

// Deprecated
clipboard.writeHtml()
// Replace with
clipboard.writeHTML()

crashReporter

代码语言:javascript
复制
// Deprecated
crashReporter.start({
  companyName: 'Crashly',
  submitURL: 'https://crash.server.com',
  autoSubmit: true
})
// Replace with
crashReporter.start({
  companyName: 'Crashly',
  submitURL: 'https://crash.server.com',
  uploadToServer: true
})

menu

代码语言:javascript
复制
// Deprecated
menu.popup(browserWindow, 100, 200, 2)
// Replace with
menu.popup(browserWindow, {x: 100, y: 200, positioningItem: 2})

nativeImage

代码语言:javascript
复制
// Deprecated
nativeImage.toPng()
// Replace with
nativeImage.toPNG()

// Deprecated
nativeImage.toJpeg()
// Replace with
nativeImage.toJPEG()

// Deprecated
nativeImage.createFromBuffer(buffer, 1.0)
// Replace with
nativeImage.createFromBuffer(buffer, {
  scaleFactor: 1.0
})

process

代码语言:javascript
复制
// Deprecated
process.versions['atom-shell']
// Replace with
process.versions.electron
  • process.versions.electronprocess.version.chrome将被设置为只读属性,以便与其他属性保持一致。process.versions由节点设置的属性。

session

代码语言:javascript
复制
// Deprecated
ses.setCertificateVerifyProc(function (hostname, certificate, callback) {
  callback(true)
})
// Replace with
ses.setCertificateVerifyProc(function (request, callback) {
  callback(0)
})

Tray

代码语言:javascript
复制
// Deprecated
tray.setHighlightMode(true)
// Replace with
tray.setHighlightMode('on')

// Deprecated
tray.setHighlightMode(false)
// Replace with
tray.setHighlightMode('off')

webContents

代码语言:javascript
复制
// Deprecated
webContents.openDevTools({detach: true})
// Replace with
webContents.openDevTools({mode: 'detach'})
代码语言:javascript
复制
// Deprecated
webContents.setZoomLevelLimits(1, 2)
// Replace with
webContents.setVisualZoomLevelLimits(1, 2)

webFrame

代码语言:javascript
复制
// Deprecated
webFrame.setZoomLevelLimits(1, 2)
// Replace with
webFrame.setVisualZoomLevelLimits(1, 2)

// Deprecated
webFrame.registerURLSchemeAsSecure('app')
// Replace with
protocol.registerStandardSchemes(['app'], {secure: true})

// Deprecated
webFrame.registerURLSchemeAsPrivileged('app', {secure: true})
// Replace with
protocol.registerStandardSchemes(['app'], {secure: true})

<webview>

代码语言:javascript
复制
// Deprecated
webview.setZoomLevelLimits(1, 2)
// Replace with
webview.setVisualZoomLevelLimits(1, 2)

节点标题URL

这是disturl.npmrc文件中指定的URL,或者--dist-url在构建本地节点模块时作为命令行标志。

重复的ARM资产

每个Electron版本包含两个相同的ARM版本,文件名略有不同,例如electron-v1.7.3-linux-arm.zipelectron-v1.7.3-linux-armv7l.zip。带有v7l前缀的资产被添加以向用户阐明其支持的ARM版本,并且将其从可能生成的未来armv6l和arm64资产中消除。

没有前缀的文件仍在发布,以避免破坏可能会消耗它的任何设置。从2.0开始,未加前缀的文件将不再发布。

详情请参阅69867189

FIXME 注释

FIXME字符串在代码注释中用于表示应该为2.0版本解决的事情。请参阅https://github.com/electron/electron/search?q=fixme

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com