📝 Add Synopsis chapter.
This commit is contained in:
parent
5933947000
commit
5c55b9412f
3 changed files with 61 additions and 16 deletions
|
@ -1,22 +1,14 @@
|
||||||
# Atom Shell documents
|
|
||||||
|
|
||||||
## Tutorials
|
## Tutorials
|
||||||
|
|
||||||
* [Quick start](tutorial/quick-start.md)
|
* [Quick start](tutorial/quick-start.md)
|
||||||
* [Application distribution](tutorial/application-distribution.md)
|
* [Application distribution](tutorial/application-distribution.md)
|
||||||
* [Use native node modules](tutorial/use-native-node-modules.md)
|
* [Use native node modules](tutorial/use-native-node-modules.md)
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
* [Coding style](development/coding-style.md)
|
|
||||||
* [Source code directory structure](development/source-code-directory-structure.md)
|
|
||||||
* [Build instructions (Mac)](development/build-instructions-mac.md)
|
|
||||||
* [Build instructions (Windows)](development/build-instructions-windows.md)
|
|
||||||
* [Build instructions (Linux)](development/build-instructions-linux.md)
|
|
||||||
|
|
||||||
## API references
|
## API references
|
||||||
|
|
||||||
Browser side modules:
|
* [Synopsis](api/synopsis.md)
|
||||||
|
|
||||||
|
Modules for browser side:
|
||||||
|
|
||||||
* [app](api/app.md)
|
* [app](api/app.md)
|
||||||
* [auto-updater](api/auto-updater.md)
|
* [auto-updater](api/auto-updater.md)
|
||||||
|
@ -28,14 +20,22 @@ Browser side modules:
|
||||||
* [power-monitor](api/power-monitor.md)
|
* [power-monitor](api/power-monitor.md)
|
||||||
* [protocol](api/protocol.md)
|
* [protocol](api/protocol.md)
|
||||||
|
|
||||||
Renderer side modules:
|
Modules for web page:
|
||||||
|
|
||||||
* [ipc (renderer)](api/ipc-renderer.md)
|
* [ipc (renderer)](api/ipc-renderer.md)
|
||||||
* [remote](api/remote.md)
|
* [remote](api/remote.md)
|
||||||
|
|
||||||
Common modules:
|
Modules for both sides:
|
||||||
|
|
||||||
* [clipboard](api/clipboard.md)
|
* [clipboard](api/clipboard.md)
|
||||||
* [crash-reporter](api/crash-reporter.md)
|
* [crash-reporter](api/crash-reporter.md)
|
||||||
* [screen](api/screen.md)
|
* [screen](api/screen.md)
|
||||||
* [shell](api/shell.md)
|
* [shell](api/shell.md)
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
* [Coding style](development/coding-style.md)
|
||||||
|
* [Source code directory structure](development/source-code-directory-structure.md)
|
||||||
|
* [Build instructions (Mac)](development/build-instructions-mac.md)
|
||||||
|
* [Build instructions (Windows)](development/build-instructions-windows.md)
|
||||||
|
* [Build instructions (Linux)](development/build-instructions-linux.md)
|
||||||
|
|
45
docs/api/synopsis.md
Normal file
45
docs/api/synopsis.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Synopsis
|
||||||
|
|
||||||
|
All [node.js's built-in modules](http://nodejs.org/api/) are available in
|
||||||
|
atom-shell, and third-party node modules are fully supported too (including the
|
||||||
|
[native modules](../tutorial/use-native-node-modules.md)).
|
||||||
|
|
||||||
|
And atom-shell also provided some extra built-in modules for developing native
|
||||||
|
desktop applications, some modules are only available on browser side, and some
|
||||||
|
are only available on renderer side, and some can be used by both sides. The
|
||||||
|
basic rule is: if a module is GUI or low level system related, then it should
|
||||||
|
be only available on browser side. You need to be familiar with the concept of
|
||||||
|
[browser side](../tutorial/quick-start.md#the-browser-side) to be able to use
|
||||||
|
those modules.
|
||||||
|
|
||||||
|
The browser side script is just like a normal `node.js` script:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var app = require('app');
|
||||||
|
var BrowserWindow = require('browser-window');
|
||||||
|
|
||||||
|
var window = null;
|
||||||
|
|
||||||
|
app.on('ready', function() {
|
||||||
|
window = new BrowserWindow({width: 800, height: 600});
|
||||||
|
window.loadUrl('https://github.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
And the web page is no different to a normal web page, except for the extra
|
||||||
|
ability to use node modules:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var remote = require('remote');
|
||||||
|
console.log(remote.require('app').getVersion());
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
To run your app, read [Run your app](../tutorial/quick-start.md#run-your-app).
|
|
@ -131,17 +131,17 @@ binary to execute your app directly.
|
||||||
On Window:
|
On Window:
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
$ .\atom-shell\atom.exe app
|
$ .\atom-shell\atom.exe path-to-app\
|
||||||
```
|
```
|
||||||
|
|
||||||
On Linux:
|
On Linux:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./atom-shell/atom app
|
$ ./atom-shell/atom path-to-app/
|
||||||
```
|
```
|
||||||
|
|
||||||
On Mac OS X:
|
On Mac OS X:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./Atom.app/Contents/MacOS/Atom app
|
$ ./Atom.app/Contents/MacOS/Atom path-to-app/
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue