Merge branch 'master' into no-vistas-no-problem

This commit is contained in:
Cheng Zhao 2015-10-06 17:02:08 +08:00
commit 2d802d6f1e
39 changed files with 907 additions and 431 deletions

View file

@ -197,12 +197,6 @@ You can request the following paths by the name:
* `~/Library/Application Support` on OS X
* `userData` The directory for storing your app's configuration files, which by
default it is the `appData` directory appended with your app's name.
* `cache` Per-user application cache directory, which by default points to:
* `%APPDATA%` on Windows (which doesn't have a universal cache location)
* `$XDG_CACHE_HOME` or `~/.cache` on Linux
* `~/Library/Caches` on OS X
* `userCache` The directory for placing your app's caches, by default it is the
`cache` directory appended with your app's name.
* `temp` Temporary directory.
* `userDesktop` The current user's Desktop directory.
* `exe` The current executable file.

View file

@ -142,7 +142,7 @@ Returns a boolean whether the image is empty.
Returns the size of the image.
[buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer
[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer
### `image.setTemplateImage(option)`

View file

@ -9,7 +9,27 @@ upstream node:
* `process.versions['chrome']` String - Version of Chromium.
* `process.resourcesPath` String - Path to JavaScript source code.
# Methods
## Events
### Event: 'loaded'
Emitted when Electron has loaded its internal initialization script and is
beginning to load the web page or the main script.
It can be used by the preload script to add removed Node global symbols back to
the global scope when node integration is turned off:
```js
// preload.js
var _setImmediate = setImmediate;
var _clearImmediate = clearImmediate;
process.once('loaded', function() {
global.setImmediate = _setImmediate;
global.clearImmediate = _clearImmediate;
});
```
## Methods
The `process` object has the following method:
@ -17,7 +37,7 @@ The `process` object has the following method:
Causes the main thread of the current process hang.
## process.setFdLimit(maxDescriptors) _OS X_ _Linux_
### process.setFdLimit(maxDescriptors) _OS X_ _Linux_
* `maxDescriptors` Integer

View file

@ -38,7 +38,7 @@ app.on('ready', function() {
var displays = electronScreen.getAllDisplays();
var externalDisplay = null;
for (var i in displays) {
if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) {
if (displays[i].bounds.x != 0 || displays[i].bounds.y != 0) {
externalDisplay = displays[i];
break;
}
@ -47,7 +47,7 @@ app.on('ready', function() {
if (externalDisplay) {
mainWindow = new BrowserWindow({
x: externalDisplay.bounds.x + 50,
y: externalDisplay.bounds.y + 50,
y: externalDisplay.bounds.y + 50
});
}
});

View file

@ -2,7 +2,7 @@
Electron enables you to create desktop applications with pure JavaScript by
providing a runtime with rich native (operating system) APIs. You could see it
as a variant of the io.js runtime that is focused on desktop applications
as a variant of the Node.js runtime that is focused on desktop applications
instead of web servers.
This doesn't mean Electron is a JavaScript binding to graphical user interface
@ -22,8 +22,9 @@ multi-process architecture is also used. Each web page in Electron runs in
its own process, which is called __the renderer process__.
In normal browsers, web pages usually run in a sandboxed environment and are not
allowed access to native resources. Electron users, however, have the power to use
io.js APIs in web pages allowing lower level operating system interactions.
allowed access to native resources. Electron users, however, have the power to
use Node.js APIs in web pages allowing lower level operating system
interactions.
### Differences Between Main Process and Renderer Process
@ -129,7 +130,7 @@ Finally the `index.html` is the web page you want to show:
</head>
<body>
<h1>Hello World!</h1>
We are using io.js <script>document.write(process.version)</script>
We are using Node.js <script>document.write(process.version)</script>
and Electron <script>document.write(process.versions['electron'])</script>.
</body>
</html>

View file

@ -4,19 +4,27 @@ Following platforms are supported by Electron:
### OS X
Only 64bit binaries are provided for OS X, and the minimum OS X version supported is OS X 10.8.
Only 64bit binaries are provided for OS X, and the minimum OS X version
supported is OS X 10.8.
### Windows
Windows 7 and later are supported, older operating systems are not supported (and do not work).
Windows 7 and later are supported, older operating systems are not supported
(and do not work).
Both `x86` and `amd64` (x64) binaries are provided for Windows, and `ARM` version of Windows is not supported for now.
Both `x86` and `amd64` (x64) binaries are provided for Windows. Please note, the
`ARM` version of Windows is not supported for now.
### Linux
The prebuilt `ia32`(`i686`) and `x64`(`amd64`) binaries of Electron are built on Ubuntu 12.04, the `arm` binary is built against ARM v7 with hard-float ABI and NEON for Debian Wheezy.
The prebuilt `ia32`(`i686`) and `x64`(`amd64`) binaries of Electron are built on
Ubuntu 12.04, the `arm` binary is built against ARM v7 with hard-float ABI and
NEON for Debian Wheezy.
Whether the prebuilt binary can run on a distribution depends on whether the distribution includes the libraries that Electron is linked to on the building platform, so only Ubuntu 12.04 is guaranteed to work, but following platforms are also verified to be able to run the prebuilt binaries of Electron:
Whether the prebuilt binary can run on a distribution depends on whether the
distribution includes the libraries that Electron is linked to on the building
platform, so only Ubuntu 12.04 is guaranteed to work, but following platforms
are also verified to be able to run the prebuilt binaries of Electron:
* Ubuntu 12.04 and later
* Fedora 21

View file

@ -6,16 +6,17 @@ the location of Electron's headers when building native modules.
## Native Node Module Compatibility
Since Node v0.11.x there were vital changes in the V8 API. So generally all
native modules written for Node v0.10.x won't work for newer Node or io.js
versions. And because Electron internally uses __io.js v3.1.0__, it has the
same problem.
Native modules might break when Node starts using a new version of V8.
To make sure the module you're interested in will work with Electron, you should
check if it supports the internal Node version used by Electron.
You can check what version of Node is used in Electron by looking it up in
the [releases](https://github.com/atom/electron/releases) page or by using
`process.version` (see [Quick Start](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md)
for example).
To solve this, you should use modules that support Node v0.11.x or later,
[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 or later
versions of Node or io.js.
Consider using [NAN](https://github.com/nodejs/nan/) for your own modules, since
it makes it easier to support multiple versions of Node. It's also helpful for
porting old modules to newer versions of Node so they can work with Electron.
## How to Install Native Modules