catch e
event.result = type: 'error', value: e.message
+ipc.on 'ATOM_BROWSER_GLOBAL', (event, processId, routingId, name) ->
+ try
+ event.result = new Meta(processId, routingId, global[name])
+ catch e
+ event.result = type: 'error', value: e.message
+
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, processId, routingId) ->
try
windows = objectsRegistry.getAllWindows()
exports.getCurrentWindow = ->
meta = ipc.sendChannelSync 'ATOM_BROWSER_CURRENT_WINDOW'
metaToValue meta
+
+# Get a global object in browser.
+exports.getGlobal = (name) ->
+ meta = ipc.sendChannelSync 'ATOM_BROWSER_GLOBAL', name
+ metaToValue meta
+
+# Get the process object in browser.
+processCache = null
+exports.__defineGetter__ 'process', ->
+ processCache = exports.getGlobal('process') unless processCache?
+ processCache