Use event.returnValue instead of event.result in atom-shell's code.
event.result is still kept for backward compatible.
This commit is contained in:
parent
b225a59a15
commit
a9c824eba1
2 changed files with 18 additions and 18 deletions
|
@ -63,15 +63,15 @@ unwrapArgs = (processId, routingId, args) ->
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_REQUIRE', (event, processId, routingId, module) ->
|
ipc.on 'ATOM_BROWSER_REQUIRE', (event, processId, routingId, module) ->
|
||||||
try
|
try
|
||||||
event.result = valueToMeta processId, routingId, require(module)
|
event.returnValue = valueToMeta processId, routingId, require(module)
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_GLOBAL', (event, processId, routingId, name) ->
|
ipc.on 'ATOM_BROWSER_GLOBAL', (event, processId, routingId, name) ->
|
||||||
try
|
try
|
||||||
event.result = valueToMeta processId, routingId, global[name]
|
event.returnValue = valueToMeta processId, routingId, global[name]
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (event, processId, routingId) ->
|
ipc.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (event, processId, routingId) ->
|
||||||
objectsRegistry.clear processId, routingId
|
objectsRegistry.clear processId, routingId
|
||||||
|
@ -80,9 +80,9 @@ ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, processId, routingId) ->
|
||||||
try
|
try
|
||||||
BrowserWindow = require 'browser-window'
|
BrowserWindow = require 'browser-window'
|
||||||
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
|
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
|
||||||
event.result = valueToMeta processId, routingId, window
|
event.returnValue = valueToMeta processId, routingId, window
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_CONSTRUCTOR', (event, processId, routingId, id, args) ->
|
ipc.on 'ATOM_BROWSER_CONSTRUCTOR', (event, processId, routingId, id, args) ->
|
||||||
try
|
try
|
||||||
|
@ -91,18 +91,18 @@ ipc.on 'ATOM_BROWSER_CONSTRUCTOR', (event, processId, routingId, id, args) ->
|
||||||
# Call new with array of arguments.
|
# Call new with array of arguments.
|
||||||
# http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
|
# http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
|
||||||
obj = new (Function::bind.apply(constructor, [null].concat(args)))
|
obj = new (Function::bind.apply(constructor, [null].concat(args)))
|
||||||
event.result = valueToMeta processId, routingId, obj
|
event.returnValue = valueToMeta processId, routingId, obj
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_FUNCTION_CALL', (event, processId, routingId, id, args) ->
|
ipc.on 'ATOM_BROWSER_FUNCTION_CALL', (event, processId, routingId, id, args) ->
|
||||||
try
|
try
|
||||||
args = unwrapArgs processId, routingId, args
|
args = unwrapArgs processId, routingId, args
|
||||||
func = objectsRegistry.get id
|
func = objectsRegistry.get id
|
||||||
ret = func.apply global, args
|
ret = func.apply global, args
|
||||||
event.result = valueToMeta processId, routingId, ret
|
event.returnValue = valueToMeta processId, routingId, ret
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', (event, processId, routingId, id, method, args) ->
|
ipc.on 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', (event, processId, routingId, id, method, args) ->
|
||||||
try
|
try
|
||||||
|
@ -110,32 +110,32 @@ ipc.on 'ATOM_BROWSER_MEMBER_CONSTRUCTOR', (event, processId, routingId, id, meth
|
||||||
constructor = objectsRegistry.get(id)[method]
|
constructor = objectsRegistry.get(id)[method]
|
||||||
# Call new with array of arguments.
|
# Call new with array of arguments.
|
||||||
obj = new (Function::bind.apply(constructor, [null].concat(args)))
|
obj = new (Function::bind.apply(constructor, [null].concat(args)))
|
||||||
event.result = valueToMeta processId, routingId, obj
|
event.returnValue = valueToMeta processId, routingId, obj
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_MEMBER_CALL', (event, processId, routingId, id, method, args) ->
|
ipc.on 'ATOM_BROWSER_MEMBER_CALL', (event, processId, routingId, id, method, args) ->
|
||||||
try
|
try
|
||||||
args = unwrapArgs processId, routingId, args
|
args = unwrapArgs processId, routingId, args
|
||||||
obj = objectsRegistry.get id
|
obj = objectsRegistry.get id
|
||||||
ret = obj[method].apply(obj, args)
|
ret = obj[method].apply(obj, args)
|
||||||
event.result = valueToMeta processId, routingId, ret
|
event.returnValue = valueToMeta processId, routingId, ret
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_MEMBER_SET', (event, processId, routingId, id, name, value) ->
|
ipc.on 'ATOM_BROWSER_MEMBER_SET', (event, processId, routingId, id, name, value) ->
|
||||||
try
|
try
|
||||||
obj = objectsRegistry.get id
|
obj = objectsRegistry.get id
|
||||||
obj[name] = value
|
obj[name] = value
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, processId, routingId, id, name) ->
|
ipc.on 'ATOM_BROWSER_MEMBER_GET', (event, processId, routingId, id, name) ->
|
||||||
try
|
try
|
||||||
obj = objectsRegistry.get id
|
obj = objectsRegistry.get id
|
||||||
event.result = valueToMeta processId, routingId, obj[name]
|
event.returnValue = valueToMeta processId, routingId, obj[name]
|
||||||
catch e
|
catch e
|
||||||
event.result = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_DEREFERENCE', (processId, routingId, storeId) ->
|
ipc.on 'ATOM_BROWSER_DEREFERENCE', (processId, routingId, storeId) ->
|
||||||
objectsRegistry.remove processId, routingId, storeId
|
objectsRegistry.remove processId, routingId, storeId
|
||||||
|
|
|
@ -23,7 +23,7 @@ ipc.on('process.exit', function(pid, rid, code) {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('eval', function(ev, pid, rid, script) {
|
ipc.on('eval', function(ev, pid, rid, script) {
|
||||||
ev.result = eval(script);
|
ev.returnValue = eval(script);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('uncaughtException', function() {
|
process.on('uncaughtException', function() {
|
||||||
|
|
Loading…
Reference in a new issue