## Documentation
-Guides and the API reference is located in the
+Guides and the API reference are located in the
[docs](https://github.com/atom/atom-shell/tree/master/docs) directory. It also
contains documents describing how to build and contribute to atom-shell.
-# Technical differences to node-webkit
+# Technical differences to Node-Webkit
-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
+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
system in web pages.
But there are also fundamental differences between the two projects that make
-atom-shell a completely separate product from node-webkit:
+atom-shell a completely separate product from Node-Webkit:
**1. Entry of application**
-In node-webkit, the main entry of an application is a web page, you specify a
+In Node-Webkit, the main entry of an application is a web page, you specify a
main page in the `package.json` and it would be opened in a browser window as
the application's main window.
html file in it with corresponding API. You also need to listen to window events
to decide when to quit the application.
-So atom-shell works more like the node.js runtime, and APIs are more low level,
+So atom-shell works more like the Node.js runtime, and APIs are more low level,
you can also use atom-shell for web testing purpose like
[phantomjs](http://phantomjs.org/),
**3. Node integration**
-In node-webkit, the node integration in web pages requires patching Chromium to
+In Node-Webkit, the Node integration in web pages requires patching Chromium to
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.
**4. Multi-context**
-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.
+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.
By using the [multi-context](http://strongloop.com/strongblog/whats-new-node-js-v0-12-multiple-context-execution/)
-feature of node, atom-shell doesn't introduce a new JavaScript context in web
+feature of Node, atom-shell doesn't introduce a new JavaScript context in web
pages.
## Prerequisites
-* [node.js](http://nodejs.org)
+* [Node.js](http://nodejs.org)
* clang and headers of GTK+ and libnotify
On Ubuntu you could install the libraries via:
## Build with grunt
-If you build your application with `grunt`, then there is a grunt task that can
-download atom-shell for current platform automatically:
+If you build your application with `grunt` there is a grunt task that can
+download atom-shell for your current platform automatically:
[grunt-download-atom-shell](https://github.com/atom/grunt-download-atom-shell).
## Introduction
-Generally, atom-shell enables you to create desktop applications with pure
-JavaScript by providing a runtime with rich native APIs, you could see it as
-an variant of node.js runtime that focused on desktop applications instead of
-web server.
+Generally atom-shell enables you to create desktop applications with pure
+JavaScript by providing a runtime with rich native APIs. You could see it as
+an variant of the Node.js runtime which is focused on desktop applications
+instead of web server.
-But it doesn't mean atom-shell is a JavaScript binding to GUI libraries, instead
+It doesn't mean atom-shell is a JavaScript binding to GUI libraries. Instead,
atom-shell uses web pages as GUI, so you could also see it as a minimal Chromium
browser, controlled by JavaScript.
### The browser side
-If you had experience with node.js web applications, you would notice that there
-are types of JavaScript scripts: the server side scripts and the client side
-scripts. The server side JavaScript, are the scripts that run on the node.js
-runtime, and the client side JavaScript, are the ones that run on user's browser.
+If you had experience with Node.js web applications, you would notice that there
+are two types of JavaScript scripts: the server side scripts and the client side
+scripts. The server side JavaScript are the scripts that run on the Node.js
+runtime, and the client side JavaScript are the ones that run on user's browser.
In atom-shell we have similar concepts, since atom-shell displays GUI by showing
web pages, we would have **scripts that run in the web page**, and also have
**scripts ran by the atom-shell runtime**, which created those web pages.
-Like node.js, we call them **client scripts**, and **browser scripts**.
+Like Node.js, we call them **client scripts**, and **browser scripts**.
-In traditional node.js applications, communication between server side and
+In traditional Node.js applications, communication between server side and
client side are usually done by web sockets. In atom-shell, we have provided
the [ipc](../api/ipc-renderer.md) module for browser side to client
communication, and the [remote](../api/remote.md) module for easy RPC
support.
-### Web page and node.js
+### Web page and Node.js
-Normal web pages are designed to not touch outside world, which makes them not
-suitable for interacting with native systems, atom-shell provides node.js APIs
+Normal web pages are designed to not touch outside world, which makes them
+unsuitable for interacting with native systems. Atom-shell provides Node.js APIs
in web pages so you could access native resources in web pages, just like
-[node-webkit](https://github.com/rogerwang/node-webkit).
+[Node-Webkit](https://github.com/rogerwang/node-webkit).
-But unlike node-webkit, you could not do native GUI related operations in web
+But unlike Node-Webkit, you could not do native GUI related operations in web
pages, instead you need to do them on the browser side by sending messages or
use the easy [remote](../api/remote.md) module.
└── index.html
```
-The format of `package.json` is exactly the same with node's modules, and the
+The format of `package.json` is exactly the same with Node's modules, and the
script specified by the `main` field is the startup script of your app, which
will run under the browser side. An example of your `package.json` is like
this:
}
```
-The `main.js` should create windows and handle system events, and an typical
+The `main.js` should create windows and handle system events, and a typical
example is:
```javascript
## Run your app
-After done writing your app, you could create a distribution of your app by
+After you're done writing your app, you could create a distribution by
following the [Application distribution](./application-distribution.md) guide
-and then execute the packaged app, or you can just use the downloaded atom-shell
+and then execute the packaged app. You can also just use the downloaded atom-shell
binary to execute your app directly.
-On Window:
+On Windows:
```cmd
$ .\atom-shell\atom.exe path-to-app\
-# Use native node modules
+# Use native Node modules
-The native node modules are supported by atom-shell, but since atom-shell is
-using a different V8 version from official node, you need to use `apm` instead
-of `npm` to install node modules.
+The native Node modules are supported by atom-shell, but since atom-shell is
+using a different V8 version from official Node, you need to use `apm` instead
+of `npm` to install Node modules.
The usage of [apm](https://github.com/atom/apm) is quite similar to `npm`, to
install dependencies from `package.json` of current project, just do:
$ apm install .
```
-But you should notice that `apm install module` wont' work because it will
+But you should notice that `apm install module` won't work because it will
install a user package for [Atom Editor](https://github.com/atom/atom) instead.
-## Native node module compability
+## Native Node module compability
-Since node v0.11.x, there were vital changes of V8 API, so generally all native
-modules written for node v0.10.x wouldn't work for node v0.11.x, and since
-atom-shell internally uses node v0.11.9, it carries with the same problem.
+Since Node v0.11.x there were vital changes in the V8 API. So generally all native
+modules written for Node v0.10.x wouldn't work for Node v0.11.x. Additionally
+since atom-shell internally uses Node v0.11.9, it carries with the same problem.
-To solve it, you should use modules that support both node v0.10.x and v0.11.x,
-and [many modules](https://www.npmjs.org/browse/depended/nan) do support the
-both now. For old modules that only support node v0.10.x, you should use the
+To solve this, you should use modules that support both Node v0.10.x and v0.11.x.
+[Many modules](https://www.npmjs.org/browse/depended/nan) do support both now.
+For old modules that only support Node v0.10.x, you should use the
[nan](https://github.com/rvagg/nan) module to port it to v0.11.x.
## Other ways of installing native modules
### The node-gyp way
-First you need to check which node release atom-shell is carrying via
-`process.version` (at the time of writing it is v0.10.5), then you can
+First you need to check which Node release atom-shell is carrying via
+`process.version` (at the time of writing it is v0.10.5). Then you can
configure and build native modules via following commands:
```bash
```
The `HOME=~/.atom-shell-gyp` changes where to find development headers. The
-`--target=0.10.5` is specifying node's version. The `--dist-url=...` specifies
+`--target=0.10.5` is specifying Node's version. The `--dist-url=...` specifies
where to download the headers.
### The npm way