Assign Promise.resolve to constant
This commit is contained in:
parent
e0260d6f53
commit
dbe9893d29
2 changed files with 4 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
const {Buffer} = require('buffer')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const {ipcRenderer, isPromise, CallbacksRegistry} = require('electron')
|
||||
const resolvePromise = Promise.resolve.bind(Promise)
|
||||
|
||||
const callbacksRegistry = new CallbacksRegistry()
|
||||
|
||||
|
@ -207,9 +208,7 @@ const metaToValue = function (meta) {
|
|||
case 'buffer':
|
||||
return Buffer.from(meta.value)
|
||||
case 'promise':
|
||||
return Promise.resolve({
|
||||
then: metaToValue(meta.then)
|
||||
})
|
||||
return resolvePromise({then: metaToValue(meta.then)})
|
||||
case 'error':
|
||||
return metaToPlainObject(meta)
|
||||
case 'date':
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
const events = require('events')
|
||||
const path = require('path')
|
||||
const Module = require('module')
|
||||
const resolvePromise = Promise.resolve.bind(Promise)
|
||||
|
||||
// We modified the original process.argv to let node.js load the
|
||||
// atom-renderer.js, we need to restore it here.
|
||||
|
@ -39,7 +40,7 @@ electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_SYNC_WEB_FRAME_METHOD', (eve
|
|||
|
||||
electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', (event, requestId, method, args) => {
|
||||
const responseCallback = function (result) {
|
||||
Promise.resolve(result)
|
||||
resolvePromise(result)
|
||||
.then((resolvedResult) => {
|
||||
event.sender.send(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, null, resolvedResult)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue