2013-09-09 15:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# remote
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The `remote`  module provides a simple way to do inter-process communication
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 19:08:31 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								(IPC) between the renderer process (web page) and the main process.
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-12 21:20:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								In Electron, GUI-related modules (such as `dialog` , `menu`  etc.) are only
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								available in the main process, not in the renderer process. In order to use them
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								from the renderer process, the `ipc`  module is necessary to send inter-process
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								messages to the main process. With the `remote`  module, you can invoke methods
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								of the main process object without explicitly sending inter-process messages,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								similar to Java's [RMI][rmi]. An example of creating a browser window from a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								renderer process:
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
									
										
										
										
											2015-11-12 21:20:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const remote = require('electron').remote;
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 22:34:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const BrowserWindow = remote.BrowserWindow;
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								var win = new BrowserWindow({ width: 800, height: 600 });
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 16:03:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								win.loadURL('https://github.com');
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-09 14:09:14 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								**Note:** for the reverse (access the renderer process from the main process),
							 
						 
					
						
							
								
									
										
										
										
											2015-09-10 12:19:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								you can use [webContents.executeJavascript ](web-contents.md#webcontentsexecutejavascriptcode-usergesture ).
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 13:38:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Remote Objects
  
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Each object (including functions) returned by the `remote`  module represents an
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								object in the main process (we call it a remote object or remote function).
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								When you invoke methods of a remote object, call a remote function, or create
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								a new object with the remote constructor (function), you are actually sending
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								synchronous inter-process messages.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								In the example above, both `BrowserWindow`  and `win`  were remote objects and
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 15:30:08 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`new BrowserWindow`  didn't create a `BrowserWindow`  object in the renderer 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								process. Instead, it created a `BrowserWindow`  object in the main process and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								returned the corresponding remote object in the renderer process, namely the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`win`  object. 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-10 21:02:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Please note that only [enumerable properties ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties ) are accessible via remote.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Lifetime of Remote Objects
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-16 11:31:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Electron makes sure that as long as the remote object in the renderer process
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								lives (in other words, has not been garbage collected), the corresponding object
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 15:30:08 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								in the main process will not be released. When the remote object has been
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								garbage collected, the corresponding object in the main process will be
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								dereferenced.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								If the remote object is leaked in the renderer process (e.g. stored in a map but
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								never freed), the corresponding object in the main process will also be leaked,
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								so you should be very careful not to leak remote objects.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Primary value types like strings and numbers, however, are sent by copy.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Passing callbacks to the main process
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Code in the main process can accept callbacks from the renderer - for instance
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 15:30:08 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								the `remote`  module - but you should be extremely careful when using this
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								feature.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								First, in order to avoid deadlocks, the callbacks passed to the main process
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								are called asynchronously. You should not expect the main process to
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								get the return value of the passed callbacks.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								For instance you can't use a function from the renderer process in an
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`Array.map`  called in the main process: 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// main process mapNumbers.js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								exports.withRendererCallback = function(mapper) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return [1,2,3].map(mapper);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								exports.withLocalCallback = function() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return exports.mapNumbers(function(x) {
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return x + 1;
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  });
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// renderer process
							 
						 
					
						
							
								
									
										
										
										
											2015-09-17 12:24:12 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var mapNumbers = require("remote").require("./mapNumbers");
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var withRendererCb = mapNumbers.withRendererCallback(function(x) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return x + 1;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								})
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var withLocalCb = mapNumbers.withLocalCallback()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								console.log(withRendererCb, withLocalCb) // [true, true, true], [2, 3, 4]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								As you can see, the renderer callback's synchronous return value was not as
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								expected, and didn't match the return value of an identical callback that lives
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								in the main process.
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Second, the callbacks passed to the main process will persist until the
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								main process garbage-collects them.
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-09 23:51:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								For example, the following code seems innocent at first glance. It installs a
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								callback for the `close`  event on a remote object:
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								remote.getCurrentWindow().on('close', function() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // blabla...
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								});
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								But remember the callback is referenced by the main process until you
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								explicitly uninstall it. If you do not, each time you reload your window the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								callback will be installed again, leaking one callback for each restart.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 15:30:08 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To make things worse, since the context of previously installed callbacks has
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								been released, exceptions will be raised in the main process when the `close` 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 19:08:31 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								event is emitted.
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To avoid this problem, ensure you clean up any references to renderer callbacks
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								passed to the main process. This involves cleaning up event handlers, or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ensuring the main process is explicitly told to deference callbacks that came
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								from a renderer process that is exiting.
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 17:10:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 22:34:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Accessing built-in modules in the main process
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The built-in modules in the main process are added as getters in the `remote` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								module, so you can use them directly like the `electron`  module.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const app = remote.app;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Methods
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The `remote`  module has the following methods:
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `remote.require(module)`
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `module`  String 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Returns the object returned by `require(module)`  in the main process.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `remote.getCurrentWindow()`
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Returns the [`BrowserWindow` ](browser-window.md ) object to which this web page
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								belongs.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `remote.getCurrentWebContents()`
  
						 
					
						
							
								
									
										
										
										
											2015-05-11 14:05:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Returns the [`WebContents` ](web-contents.md ) object of this web page.
							 
						 
					
						
							
								
									
										
										
										
											2015-05-11 14:05:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `remote.getGlobal(name)`
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `name`  String 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Returns the global variable of `name`  (e.g. `global[name]` ) in the main
							 
						 
					
						
							
								
									
										
										
										
											2013-12-30 22:06:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								process.
							 
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `remote.process`
  
						 
					
						
							
								
									
										
										
										
											2013-08-14 15:43:35 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 10:20:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Returns the `process`  object in the main process. This is the same as
							 
						 
					
						
							
								
									
										
										
										
											2015-08-28 22:17:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`remote.getGlobal('process')`  but is cached. 
						 
					
						
							
								
									
										
										
										
											2015-11-12 21:20:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[rmi]: http://en.wikipedia.org/wiki/Java_remote_method_invocation