🎨 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

@ -2,7 +2,7 @@
const electron = require('electron')
const v8Util = process.atomBinding('v8_util')
const {ipcMain} = electron
const {ipcMain, isPromise} = electron
const objectsRegistry = require('./objects-registry')
@ -65,7 +65,7 @@ let valueToMeta = function (sender, value, optimizeSimpleObject = false) {
meta.type = 'error'
} else if (value instanceof Date) {
meta.type = 'date'
} else if (value.constructor != null && value.constructor.name === 'Promise') {
} else if (isPromise(value)) {
meta.type = 'promise'
} else if (value.hasOwnProperty('callee') && value.length != null) {
// Treat the arguments object as array.