Cheat on the remote object's constructor name.
This commit is contained in:
parent
ddad3e4846
commit
a7ddf57620
1 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
ipc = require 'ipc'
|
ipc = require 'ipc'
|
||||||
|
v8_util = process.atom_binding 'v8_util'
|
||||||
|
|
||||||
generateFromPainObject = (plain) ->
|
generateFromPainObject = (plain) ->
|
||||||
switch plain.type
|
switch plain.type
|
||||||
|
@ -6,13 +7,12 @@ generateFromPainObject = (plain) ->
|
||||||
when 'value' then plain.value
|
when 'value' then plain.value
|
||||||
when 'array' then (generateFromPainObject(el) for el in plain.members)
|
when 'array' then (generateFromPainObject(el) for el in plain.members)
|
||||||
else
|
else
|
||||||
ret = {}
|
|
||||||
if plain.type is 'function'
|
if plain.type is 'function'
|
||||||
# A shadow class to represent the remote function object.
|
# A shadow class to represent the remote function object.
|
||||||
ret =
|
ret =
|
||||||
class RemoteObject
|
class RemoteFunction
|
||||||
constructor: ->
|
constructor: ->
|
||||||
if @constructor == RemoteObject
|
if @constructor == RemoteFunction
|
||||||
# Constructor call.
|
# Constructor call.
|
||||||
obj = ipc.sendChannelSync 'ATOM_INTERNAL_CONSTRUCTOR', plain.id, Array::slice.call(arguments)
|
obj = ipc.sendChannelSync 'ATOM_INTERNAL_CONSTRUCTOR', plain.id, Array::slice.call(arguments)
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ generateFromPainObject = (plain) ->
|
||||||
# Function call.
|
# Function call.
|
||||||
ret = ipc.sendChannelSync 'ATOM_INTERNAL_FUNCTION_CALL', plain.id, Array::slice.call(arguments)
|
ret = ipc.sendChannelSync 'ATOM_INTERNAL_FUNCTION_CALL', plain.id, Array::slice.call(arguments)
|
||||||
return generateFromPainObject ret
|
return generateFromPainObject ret
|
||||||
|
else
|
||||||
|
ret = v8_util.createObjectWithName plain.name
|
||||||
|
|
||||||
# Polulate delegate members.
|
# Polulate delegate members.
|
||||||
for member in plain.members
|
for member in plain.members
|
||||||
|
|
Loading…
Add table
Reference in a new issue