2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Technical differences to Node-Webkit
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Like Node-Webkit, atom-shell provides a platform to write desktop applications
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								with JavaScript and HTML, and has Node integration to grant access to low level
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								system in web pages.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 09:52:24 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								But there are also fundamental differences between the two projects that make
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								atom-shell a completely separate product from Node-Webkit:
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:22:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								**1. Entry of application**
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								In Node-Webkit, the main entry of an application is a web page, you specify a
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								main page in the `package.json` and it would be opened in a browser window as
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								the application's main window.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								While in atom-shell, the entry point is a JavaScript script, instead of
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								providing a URL directly, you need to manually create a browser window and load
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								html file in it with corresponding API. You also need to listen to window events
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								to decide when to quit the application.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								So atom-shell works more like the Node.js runtime, and APIs are more low level,
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								you can also use atom-shell for web testing purpose like
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-08 15:38:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[phantomjs](http://phantomjs.org/).
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:22:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								**2. Build system**
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								In order to avoid the complexity of building the whole Chromium, atom-shell uses
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[libchromiumcontent](https://github.com/brightray/libchromiumcontent) to access
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Chromium's Content API, libchromiumcontent is a single, shared library that
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								includes the Chromium Content module and all its dependencies. So users don't
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								need a powerful machine to build atom-shell.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:22:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								**3. Node integration**
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								In Node-Webkit, the Node integration in web pages requires patching Chromium to
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								work, while in atom-shell we chose a different way to integrate libuv loop to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								each platform's message loop to avoid hacking Chromium, see the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[`node_bindings`](../../atom/common/) code for how that was done.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:22:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								**4. Multi-context**
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								If you are an experienced Node-Webkit user, you should be familiar with the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								concept of Node context and web context, these concepts were invented because
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								of how the Node-Webkit was implemented.
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								By using the [multi-context](http://strongloop.com/strongblog/whats-new-node-js-v0-12-multiple-context-execution/)
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-07 00:06:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								feature of Node, atom-shell doesn't introduce a new JavaScript context in web
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-06 15:16:54 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								pages.
							 |