Remove uses of deprecated APIs in remote module
This commit is contained in:
parent
275ac2c4b6
commit
d46300587a
1 changed files with 11 additions and 11 deletions
|
@ -40,7 +40,7 @@ metaToValue = (meta) ->
|
||||||
constructor: ->
|
constructor: ->
|
||||||
if @constructor == RemoteFunction
|
if @constructor == RemoteFunction
|
||||||
# Constructor call.
|
# Constructor call.
|
||||||
obj = ipc.sendChannelSync 'ATOM_BROWSER_CONSTRUCTOR', meta.id, wrapArgs(arguments)
|
obj = ipc.sendSync 'ATOM_BROWSER_CONSTRUCTOR', meta.id, wrapArgs(arguments)
|
||||||
|
|
||||||
# Returning object in constructor will replace constructed object
|
# Returning object in constructor will replace constructed object
|
||||||
# with the returned object.
|
# with the returned object.
|
||||||
|
@ -48,7 +48,7 @@ metaToValue = (meta) ->
|
||||||
return metaToValue obj
|
return metaToValue obj
|
||||||
else
|
else
|
||||||
# Function call.
|
# Function call.
|
||||||
ret = ipc.sendChannelSync 'ATOM_BROWSER_FUNCTION_CALL', meta.id, wrapArgs(arguments)
|
ret = ipc.sendSync 'ATOM_BROWSER_FUNCTION_CALL', meta.id, wrapArgs(arguments)
|
||||||
return metaToValue ret
|
return metaToValue ret
|
||||||
else
|
else
|
||||||
ret = v8Util.createObjectWithName meta.name
|
ret = v8Util.createObjectWithName meta.name
|
||||||
|
@ -62,27 +62,27 @@ metaToValue = (meta) ->
|
||||||
constructor: ->
|
constructor: ->
|
||||||
if @constructor is RemoteMemberFunction
|
if @constructor is RemoteMemberFunction
|
||||||
# Constructor call.
|
# Constructor call.
|
||||||
obj = ipc.sendChannelSync 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', meta.id, member.name, wrapArgs(arguments)
|
obj = ipc.sendSync 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', meta.id, member.name, wrapArgs(arguments)
|
||||||
return metaToValue obj
|
return metaToValue obj
|
||||||
else
|
else
|
||||||
# Call member function.
|
# Call member function.
|
||||||
ret = ipc.sendChannelSync 'ATOM_BROWSER_MEMBER_CALL', meta.id, member.name, wrapArgs(arguments)
|
ret = ipc.sendSync 'ATOM_BROWSER_MEMBER_CALL', meta.id, member.name, wrapArgs(arguments)
|
||||||
return metaToValue ret
|
return metaToValue ret
|
||||||
else
|
else
|
||||||
ret.__defineSetter__ member.name, (value) ->
|
ret.__defineSetter__ member.name, (value) ->
|
||||||
# Set member data.
|
# Set member data.
|
||||||
ipc.sendChannelSync 'ATOM_BROWSER_MEMBER_SET', meta.id, member.name, value
|
ipc.sendSync 'ATOM_BROWSER_MEMBER_SET', meta.id, member.name, value
|
||||||
value
|
value
|
||||||
|
|
||||||
ret.__defineGetter__ member.name, ->
|
ret.__defineGetter__ member.name, ->
|
||||||
# Get member data.
|
# Get member data.
|
||||||
ret = ipc.sendChannelSync 'ATOM_BROWSER_MEMBER_GET', meta.id, member.name
|
ret = ipc.sendSync 'ATOM_BROWSER_MEMBER_GET', meta.id, member.name
|
||||||
metaToValue ret
|
metaToValue ret
|
||||||
|
|
||||||
# Track delegate object's life time, and tell the browser to clean up
|
# Track delegate object's life time, and tell the browser to clean up
|
||||||
# when the object is GCed.
|
# when the object is GCed.
|
||||||
v8Util.setDestructor ret, ->
|
v8Util.setDestructor ret, ->
|
||||||
ipc.sendChannel 'ATOM_BROWSER_DEREFERENCE', meta.storeId
|
ipc.send 'ATOM_BROWSER_DEREFERENCE', meta.storeId
|
||||||
|
|
||||||
# Remember object's id.
|
# Remember object's id.
|
||||||
v8Util.setHiddenValue ret, 'atomId', meta.id
|
v8Util.setHiddenValue ret, 'atomId', meta.id
|
||||||
|
@ -104,19 +104,19 @@ moduleCache = {}
|
||||||
exports.require = (module) ->
|
exports.require = (module) ->
|
||||||
return moduleCache[module] if moduleCache[module]?
|
return moduleCache[module] if moduleCache[module]?
|
||||||
|
|
||||||
meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module
|
meta = ipc.sendSync 'ATOM_BROWSER_REQUIRE', module
|
||||||
moduleCache[module] = metaToValue meta
|
moduleCache[module] = metaToValue meta
|
||||||
|
|
||||||
# Get current window object.
|
# Get current window object.
|
||||||
windowCache = null
|
windowCache = null
|
||||||
exports.getCurrentWindow = ->
|
exports.getCurrentWindow = ->
|
||||||
return windowCache if windowCache?
|
return windowCache if windowCache?
|
||||||
meta = ipc.sendChannelSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId
|
meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId
|
||||||
windowCache = metaToValue meta
|
windowCache = metaToValue meta
|
||||||
|
|
||||||
# Get a global object in browser.
|
# Get a global object in browser.
|
||||||
exports.getGlobal = (name) ->
|
exports.getGlobal = (name) ->
|
||||||
meta = ipc.sendChannelSync 'ATOM_BROWSER_GLOBAL', name
|
meta = ipc.sendSync 'ATOM_BROWSER_GLOBAL', name
|
||||||
metaToValue meta
|
metaToValue meta
|
||||||
|
|
||||||
# Get the process object in browser.
|
# Get the process object in browser.
|
||||||
|
@ -133,5 +133,5 @@ exports.createFunctionWithReturnValue = (returnValue) ->
|
||||||
|
|
||||||
# Get the guest WebContents from guestInstanceId.
|
# Get the guest WebContents from guestInstanceId.
|
||||||
exports.getGuestWebContents = (guestInstanceId) ->
|
exports.getGuestWebContents = (guestInstanceId) ->
|
||||||
meta = ipc.sendChannelSync 'ATOM_BROWSER_GUEST_WEB_CONTENTS', guestInstanceId
|
meta = ipc.sendSync 'ATOM_BROWSER_GUEST_WEB_CONTENTS', guestInstanceId
|
||||||
metaToValue meta
|
metaToValue meta
|
||||||
|
|
Loading…
Reference in a new issue