41c2685204
* feat: promisify win.capturePage * mark optional arg correctly * Add to breaking changes doc * properly deprecate win.capturePage * remove change from api-contract * document both callback and promise versions * address docs feedback * update promisification progress doc
8.8 KiB
8.8 KiB
Promisification
The Electron team is currently undergoing an initiative to convert callback-based functions in Electron to return Promises. During this transition period, both the callback and Promise-based versions of these functions will work correctly, and will both be documented.
To enable deprecation warnings for these updated functions, use the process.enablePromiseAPI
runtime flag.
When a majority of affected functions are migrated, this flag will be enabled by default and all developers will be able to see these deprecation warnings. At that time, the callback-based versions will also be removed from documentation. This document will be continuously updated as more functions are converted.
Candidate Functions
- app.getFileIcon(path[, options], callback)
- app.importCertificate(options, callback)
- win.hookWindowMessage(message, callback)
- request.write(chunk[, encoding][, callback])
- request.end([chunk][, encoding][, callback])
- contentTracing.getCategories(callback)
- contentTracing.startRecording(options, callback)
- contentTracing.stopRecording(resultFilePath, callback)
- contentTracing.startMonitoring(options, callback)
- contentTracing.stopMonitoring(callback)
- contentTracing.captureMonitoringSnapshot(resultFilePath, callback)
- contentTracing.getTraceBufferUsage(callback)
- cookies.get(filter, callback)
- cookies.set(details, callback)
- cookies.remove(url, name, callback)
- cookies.flushStore(callback)
- debugger.sendCommand(method[, commandParams, callback])
- desktopCapturer.getSources(options, callback)
- dialog.showOpenDialog([browserWindow, ]options[, callback])
- dialog.showSaveDialog([browserWindow, ]options[, callback])
- dialog.showMessageBox([browserWindow, ]options[, callback])
- dialog.showCertificateTrustDialog([browserWindow, ]options, callback)
- globalShortcut.register(accelerator, callback)
- globalShortcut.registerAll(accelerators, callback)
- inAppPurchase.purchaseProduct(productID, quantity, callback)
- inAppPurchase.getProducts(productIDs, callback)
- netLog.stopLogging([callback])
- protocol.isProtocolHandled(scheme, callback)
- ses.getCacheSize(callback)
- ses.clearCache(callback)
- ses.clearStorageData([options, callback])
- ses.setProxy(config, callback)
- ses.resolveProxy(url, callback)
- ses.clearHostResolverCache([callback])
- ses.getBlobData(identifier, callback)
- ses.clearAuthCache(options[, callback])
- shell.openExternal(url[, options, callback])
- systemPreferences.subscribeNotification(event, callback)
- systemPreferences.subscribeLocalNotification(event, callback)
- systemPreferences.subscribeWorkspaceNotification(event, callback)
- contents.executeJavaScript(code[, userGesture, callback])
- contents.getZoomFactor(callback)
- contents.getZoomLevel(callback)
- contents.hasServiceWorker(callback)
- contents.unregisterServiceWorker(callback)
- contents.print([options], [callback])
- contents.printToPDF(options, callback)
- contents.beginFrameSubscription([onlyDirty ,]callback)
- contents.savePage(fullPath, saveType, callback)
- webFrame.executeJavaScript(code[, userGesture, callback])
- webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])
- webviewTag.executeJavaScript(code[, userGesture, callback])
- webviewTag.printToPDF(options, callback)
- webviewTag.getZoomFactor(callback)
- webviewTag.getZoomLevel(callback)