Renamed browser-side to main process
renamed a few occurances of "web page" to "renderer" renamed a few files that had "browser" in their name to "main-process" note that there are still many occurances of web page.
This commit is contained in:
		
					parent
					
						
							
								1804466334
							
						
					
				
			
			
				commit
				
					
						b6875ad49b
					
				
			
		
					 15 changed files with 103 additions and 111 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
# Debugging browser process
 | 
			
		||||
# Debugging the main process
 | 
			
		||||
 | 
			
		||||
The devtools of browser window can only debug the scripts of the web pages
 | 
			
		||||
(e.g. the renderer process), in order to provide a way to debug the scripts of
 | 
			
		||||
the browser side (e.g. the browser process), atom-shell has provided the
 | 
			
		||||
`--debug` and `--debug-brk` switches.
 | 
			
		||||
The devtools of browser window can only debug the renderer process scripts.
 | 
			
		||||
(I.e. the web pages.) In order to provide a way to debug the scripts of
 | 
			
		||||
the main process, atom-shell has provided the `--debug` and `--debug-brk`
 | 
			
		||||
switches.
 | 
			
		||||
 | 
			
		||||
## Command line switches
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ Like `--debug` but pauses the script on the first line.
 | 
			
		|||
## Use node-inspector for debugging
 | 
			
		||||
 | 
			
		||||
__Note:__ Atom Shell uses node v0.11.13, which currently doesn't work very well
 | 
			
		||||
with node-inspector, and the browser process would crash if you inspect the
 | 
			
		||||
with node-inspector, and the main process would crash if you inspect the
 | 
			
		||||
`process` object under node-inspector's console.
 | 
			
		||||
 | 
			
		||||
### 1. Start the [node-inspector][node-inspector] server
 | 
			
		||||
| 
						 | 
				
			
			@ -37,10 +37,10 @@ _online-status.html_
 | 
			
		|||
```
 | 
			
		||||
 | 
			
		||||
There may be instances where one wants to respond to these events in the
 | 
			
		||||
browser process as well.  The browser process however does not have a
 | 
			
		||||
main process as well.  The main process however does not have a
 | 
			
		||||
`navigator` object and thus cannot detect these events directly.  Using
 | 
			
		||||
Atom-shell's inter-process communication utilities, the events can be forwarded
 | 
			
		||||
to the browser process and handled as needed, as shown in the following example.
 | 
			
		||||
to the main process and handled as needed, as shown in the following example.
 | 
			
		||||
 | 
			
		||||
_main.js_
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,26 +11,18 @@ It doesn't mean atom-shell is a JavaScript binding to GUI libraries. Instead,
 | 
			
		|||
atom-shell uses web pages as its GUI, so you could also see it as a minimal
 | 
			
		||||
Chromium browser, controlled by JavaScript.
 | 
			
		||||
 | 
			
		||||
### The browser side
 | 
			
		||||
### The main process
 | 
			
		||||
 | 
			
		||||
If you have experience with Node.js web applications, you will know that there
 | 
			
		||||
are two types of JavaScript scripts: the server side scripts and the client side
 | 
			
		||||
scripts. Server-side JavaScript is that which runs on the Node.js
 | 
			
		||||
runtime, while client-side JavaScript runs inside the user's browser.
 | 
			
		||||
The main atom-shell process displays a GUI by showing web pages. We have
 | 
			
		||||
**scripts that run in the atom-shell runtime**, that create **scripts
 | 
			
		||||
that run in the web page**. We call them **main process scripts**,
 | 
			
		||||
and **renderer process scripts**.
 | 
			
		||||
 | 
			
		||||
In atom-shell we have similar concepts: Since atom-shell displays a GUI by
 | 
			
		||||
showing web pages, we have **scripts that run in the web page**, and also
 | 
			
		||||
**scripts run by the atom-shell runtime**, which creates those web pages.
 | 
			
		||||
Like Node.js, we call them **client scripts**, and **browser scripts**
 | 
			
		||||
(meaning the browser replaces the concept of the server here).
 | 
			
		||||
In atom-shell, we have provided the [ipc](../api/ipc-renderer.md) module for
 | 
			
		||||
communication from the main process to the renderer process, and the
 | 
			
		||||
[remote](../api/remote.md) module for easy RPC support.
 | 
			
		||||
 | 
			
		||||
In traditional Node.js applications, communication between server and
 | 
			
		||||
client is usually facilitated via web sockets. In atom-shell, we have provided
 | 
			
		||||
the [ipc](../api/ipc-renderer.md) module for browser to client
 | 
			
		||||
communication, and the [remote](../api/remote.md) module for easy RPC
 | 
			
		||||
support.
 | 
			
		||||
 | 
			
		||||
### Web page and Node.js
 | 
			
		||||
### The renderer process
 | 
			
		||||
 | 
			
		||||
Normal web pages are designed to not reach outside of the browser, which makes
 | 
			
		||||
them unsuitable for interacting with native systems. Atom-shell provides Node.js
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +30,7 @@ APIs in web pages so you can access native resources from web pages, just like
 | 
			
		|||
[nw.js](https://github.com/nwjs/nw.js).
 | 
			
		||||
 | 
			
		||||
But unlike nw.js, you cannot do native GUI related operations in web
 | 
			
		||||
pages. Instead you need to do them on the browser side by sending messages to
 | 
			
		||||
pages. Instead you need to do them on the main process by sending messages to
 | 
			
		||||
it, or using the easy [remote](../api/remote.md) module.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +48,7 @@ your-app/
 | 
			
		|||
 | 
			
		||||
The format of `package.json` is exactly the same as that of Node's modules, and
 | 
			
		||||
the script specified by the `main` field is the startup script of your app,
 | 
			
		||||
which will run on the browser side. An example of your `package.json` might look
 | 
			
		||||
which will run on the main process. An example of your `package.json` might look
 | 
			
		||||
like this:
 | 
			
		||||
 | 
			
		||||
```json
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue