Support remote Promise in browser
This commit is contained in:
parent
c7d1f4f6b2
commit
92af275f98
2 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,7 @@ unwrapArgs = (sender, args) ->
|
||||||
when 'remote-object' then objectsRegistry.get meta.id
|
when 'remote-object' then objectsRegistry.get meta.id
|
||||||
when 'array' then unwrapArgs sender, meta.value
|
when 'array' then unwrapArgs sender, meta.value
|
||||||
when 'buffer' then new Buffer(meta.value)
|
when 'buffer' then new Buffer(meta.value)
|
||||||
|
when 'promise' then Promise.resolve(then: metaToValue(meta.then))
|
||||||
when 'object'
|
when 'object'
|
||||||
ret = v8Util.createObjectWithName meta.name
|
ret = v8Util.createObjectWithName meta.name
|
||||||
for member in meta.members
|
for member in meta.members
|
||||||
|
|
|
@ -20,6 +20,8 @@ wrapArgs = (args, visited=[]) ->
|
||||||
type: 'array', value: wrapArgs(value, visited)
|
type: 'array', value: wrapArgs(value, visited)
|
||||||
else if Buffer.isBuffer value
|
else if Buffer.isBuffer value
|
||||||
type: 'buffer', value: Array::slice.call(value, 0)
|
type: 'buffer', value: Array::slice.call(value, 0)
|
||||||
|
else if Promise.resolve(value) == value
|
||||||
|
type: 'promise', then: valueToMeta(value.then.bind(value))
|
||||||
else if value? and typeof value is 'object' and v8Util.getHiddenValue value, 'atomId'
|
else if value? and typeof value is 'object' and v8Util.getHiddenValue value, 'atomId'
|
||||||
type: 'remote-object', id: v8Util.getHiddenValue value, 'atomId'
|
type: 'remote-object', id: v8Util.getHiddenValue value, 'atomId'
|
||||||
else if value? and typeof value is 'object'
|
else if value? and typeof value is 'object'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue