Make docs follow 80 columns rule.

This commit is contained in:
Cheng Zhao 2014-09-25 23:22:29 +08:00
parent 8acf96d268
commit fc8ff314e2

View file

@ -8,8 +8,8 @@ a variant of the Node.js runtime which is focused on desktop applications
instead of web servers. instead of web servers.
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 its GUI, so you could also see it as a minimal Chromium atom-shell uses web pages as its GUI, so you could also see it as a minimal
browser, controlled by JavaScript. Chromium browser, controlled by JavaScript.
### The browser side ### The browser side
@ -18,9 +18,11 @@ 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 scripts. Server-side JavaScript is that which runs on the Node.js
runtime, while client-side JavaScript runs inside the user's browser. runtime, while client-side JavaScript runs inside the user's browser.
In atom-shell we have similar concepts: Since atom-shell displays a GUI by showing In atom-shell we have similar concepts: Since atom-shell displays a GUI by
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. showing web pages, we have **scripts that run in the web page**, and also
Like Node.js, we call them **client scripts**, and **browser scripts** (meaning the browser replaces the concept of the server here). **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 traditional Node.js applications, communication between server and In traditional Node.js applications, communication between server and
client is usually facilitated via web sockets. In atom-shell, we have provided client is usually facilitated via web sockets. In atom-shell, we have provided
@ -30,19 +32,20 @@ support.
### Web page and Node.js ### Web page and Node.js
Normal web pages are designed to not reach outside of the browser, which makes them Normal web pages are designed to not reach outside of the browser, which makes
unsuitable for interacting with native systems. Atom-shell provides Node.js APIs them unsuitable for interacting with native systems. Atom-shell provides Node.js
in web pages so you can access native resources from web pages, just like APIs in web pages so you can access native resources from 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 cannot do native GUI related operations in web But unlike Node-Webkit, you cannot do native GUI related operations in web
pages. Instead you need to do them on the browser side by sending messages to it, or pages. Instead you need to do them on the browser side by sending messages to
using the easy [remote](../api/remote.md) module. it, or using the easy [remote](../api/remote.md) module.
## Write your first atom-shell app ## Write your first atom-shell app
Generally, an atom-shell app would be structured like this (see the [hello-atom](https://github.com/dougnukem/hello-atom) repo for reference): Generally, an atom-shell app would be structured like this (see the
[hello-atom](https://github.com/dougnukem/hello-atom) repo for reference):
```text ```text
your-app/ your-app/
@ -51,10 +54,10 @@ your-app/
└── index.html └── index.html
``` ```
The format of `package.json` is exactly the same as that of Node's modules, and the The format of `package.json` is exactly the same as that of Node's modules, and
script specified by the `main` field is the startup script of your app, which the script specified by the `main` field is the startup script of your app,
will run on the browser side. An example of your `package.json` might look like which will run on the browser side. An example of your `package.json` might look
this: like this:
```json ```json
{ {
@ -123,8 +126,8 @@ Finally the `index.html` is the web page you want to show:
After you're done writing your app, you can create a distribution by After you're done writing your app, you can create a distribution by
following the [Application distribution](./application-distribution.md) guide following the [Application distribution](./application-distribution.md) guide
and then execute the packaged app. and then execute the packaged app. You can also just use the downloaded
You can also just use the downloaded atom-shell binary to execute your app directly. atom-shell binary to execute your app directly.
On Windows: On Windows:
@ -144,4 +147,5 @@ On Mac OS X:
$ ./Atom.app/Contents/MacOS/Atom your-app/ $ ./Atom.app/Contents/MacOS/Atom your-app/
``` ```
`Atom.app` here is part of the atom-shell's release package, you can download it from [here](https://github.com/atom/atom-shell/releases). `Atom.app` here is part of the atom-shell's release package, you can download
it from [here](https://github.com/atom/atom-shell/releases).