2018-11-26 21:00:46 +00:00
## 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
2019-01-17 17:30:32 +00:00
- [app.importCertificate(options, callback) ](https://github.com/electron/electron/blob/master/docs/api/app.md#importCertificate )
- [dialog.showMessageBox([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showMessageBox)
- [dialog.showCertificateTrustDialog([browserWindow, ]options, callback)](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showCertificateTrustDialog)
- [inAppPurchase.purchaseProduct(productID, quantity, callback) ](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#purchaseProduct )
- [inAppPurchase.getProducts(productIDs, callback) ](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#getProducts )
- [ses.getBlobData(identifier, callback) ](https://github.com/electron/electron/blob/master/docs/api/session.md#getBlobData )
- [contents.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#executeJavaScript)
- [contents.print([options], [callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#print)
- [webFrame.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScript)
- [webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScriptInIsolatedWorld)
- [webviewTag.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#executeJavaScript)
2018-11-26 21:00:46 +00:00
2018-11-28 04:50:53 +00:00
### Converted Functions
2019-01-17 17:30:32 +00:00
- [app.getFileIcon(path[, options], callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#getFileIcon)
2019-01-25 18:11:35 +00:00
- [contents.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#capturePage)
2019-02-11 19:20:04 +00:00
- [contents.printToPDF(options, callback) ](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#printToPDF )
2019-02-14 17:03:28 +00:00
- [contents.savePage(fullPath, saveType, callback) ](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#savePage )
2019-01-30 20:39:55 +00:00
- [contentTracing.getCategories(callback) ](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getCategories )
2019-01-31 02:53:55 +00:00
- [contentTracing.startRecording(options, callback) ](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#startRecording )
- [contentTracing.stopRecording(resultFilePath, callback) ](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#stopRecording )
2019-02-13 21:24:57 +00:00
- [contentTracing.getTraceBufferUsage(callback) ](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getTraceBufferUsage )
2019-01-25 18:11:35 +00:00
- [cookies.flushStore(callback) ](https://github.com/electron/electron/blob/master/docs/api/cookies.md#flushStore )
- [cookies.get(filter, callback) ](https://github.com/electron/electron/blob/master/docs/api/cookies.md#get )
- [cookies.remove(url, name, callback) ](https://github.com/electron/electron/blob/master/docs/api/cookies.md#remove )
- [cookies.set(details, callback) ](https://github.com/electron/electron/blob/master/docs/api/cookies.md#set )
2019-02-13 17:23:53 +00:00
- [debugger.sendCommand(method[, commandParams, callback])](https://github.com/electron/electron/blob/master/docs/api/debugger.md#sendCommand)
2019-01-25 18:11:35 +00:00
- [desktopCapturer.getSources(options, callback) ](https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md#getSources )
2019-03-05 13:54:48 +00:00
- [dialog.showOpenDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showOpenDialog)
2019-03-05 21:48:20 +00:00
- [dialog.showSaveDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showSaveDialog)
- [netLog.stopLogging([callback])](https://github.com/electron/electron/blob/master/docs/api/net-log.md#stopLogging)
2019-01-17 17:30:32 +00:00
- [protocol.isProtocolHandled(scheme, callback) ](https://github.com/electron/electron/blob/master/docs/api/protocol.md#isProtocolHandled )
2019-03-08 18:26:17 +00:00
- [ses.clearHostResolverCache([callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearHostResolverCache)
2019-03-08 17:02:30 +00:00
- [ses.clearStorageData([options, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearStorageData)
2019-03-08 20:51:12 +00:00
- [ses.setProxy(config, callback) ](https://github.com/electron/electron/blob/master/docs/api/session.md#setProxy )
- [ses.resolveProxy(url, callback) ](https://github.com/electron/electron/blob/master/docs/api/session.md#resolveProxy )
2019-03-08 22:42:03 +00:00
- [ses.getCacheSize(callback) ](https://github.com/electron/electron/blob/master/docs/api/session.md#getCacheSize )
2019-03-09 02:41:42 +00:00
- [ses.clearAuthCache(options[, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearAuthCache)
2019-03-08 22:42:03 +00:00
- [ses.clearCache(callback) ](https://github.com/electron/electron/blob/master/docs/api/session.md#clearCache )
2019-01-25 18:11:35 +00:00
- [shell.openExternal(url[, options, callback])](https://github.com/electron/electron/blob/master/docs/api/shell.md#openExternal)
- [webviewTag.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#capturePage)
2019-02-11 19:20:04 +00:00
- [webviewTag.printToPDF(options, callback) ](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#printToPDF )
2019-01-25 18:11:35 +00:00
- [win.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#capturePage)