]> khamidou — GitHub mirrors - electron.git/commitdiff
Cache remote.getCurrentWindow.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 3 May 2013 13:14:28 +0000 (21:14 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 3 May 2013 13:14:28 +0000 (21:14 +0800)
renderer/api/lib/remote.coffee

index 23f5c6bae0a439cf3b4f955f4cc8024cac8f4823..3cdcb3f3d72eba06e9868cd45930b278e247b9c3 100644 (file)
@@ -68,9 +68,11 @@ exports.getObject = (id) ->
   metaToValue meta
 
 # Get current window object.
+windowCache = null
 exports.getCurrentWindow = ->
+  return windowCache if windowCache?
   meta = ipc.sendChannelSync 'ATOM_BROWSER_CURRENT_WINDOW'
-  metaToValue meta
+  windowCache = metaToValue meta
 
 # Get a global object in browser.
 exports.getGlobal = (name) ->