🎨 Support non-native promises

This commit is contained in:
cdaringe 2016-05-24 23:38:35 -06:00
parent 4cd0de0e87
commit 32073fa079
No known key found for this signature in database
GPG key ID: 8C3201E7E66E08D0
5 changed files with 24 additions and 4 deletions

View file

@ -1,7 +1,7 @@
'use strict'
const v8Util = process.atomBinding('v8_util')
const {ipcRenderer, CallbacksRegistry} = require('electron')
const {ipcRenderer, isPromise, CallbacksRegistry} = require('electron')
const callbacksRegistry = new CallbacksRegistry()
@ -44,7 +44,7 @@ var wrapArgs = function (args, visited) {
value: value.getTime()
}
} else if ((value != null) && typeof value === 'object') {
if (value.constructor != null && value.constructor.name === 'Promise') {
if (isPromise(value)) {
return {
type: 'promise',
then: valueToMeta(function (onFulfilled, onRejected) {