Merge remote-tracking branch 'origin/master' into hands-on-hand-off
This commit is contained in:
commit
b53480e15c
75 changed files with 1097 additions and 298 deletions
|
@ -7,8 +7,8 @@ upstream node:
|
|||
|
||||
* `process.type` String - Process's type, can be `browser` (i.e. main process)
|
||||
or `renderer`.
|
||||
* `process.versions['electron']` String - Version of Electron.
|
||||
* `process.versions['chrome']` String - Version of Chromium.
|
||||
* `process.versions.electron` String - Version of Electron.
|
||||
* `process.versions.chrome` String - Version of Chromium.
|
||||
* `process.resourcesPath` String - Path to JavaScript source code.
|
||||
* `process.mas` Boolean - For Mac App Store build, this value is `true`, for
|
||||
other builds it is `undefined`.
|
||||
|
|
|
@ -59,7 +59,7 @@ not (transparent windows won't work correctly when DWM composition is disabled):
|
|||
let browserOptions = {width: 1000, height: 800};
|
||||
|
||||
// Make the window transparent only if the platform supports it.
|
||||
if (process.platform !== 'win32' || app.isAeroGlassEnabled()) {
|
||||
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
|
||||
browserOptions.transparent = true;
|
||||
browserOptions.frame = false;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ Follow the guidelines below for building Electron on Linux.
|
|||
|
||||
## Prerequisites
|
||||
|
||||
* At least 25GB disk space and 8GB RAM.
|
||||
* Python 2.7.x. Some distributions like CentOS still use Python 2.6.x
|
||||
so you may need to check your Python version with `python -V`.
|
||||
* Node.js v0.12.x. There are various ways to install Node. You can download
|
||||
|
@ -33,11 +34,6 @@ $ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-
|
|||
Other distributions may offer similar packages for installation via package
|
||||
managers such as pacman. Or one can compile from source code.
|
||||
|
||||
## If You Use Virtual Machines For Building
|
||||
|
||||
If you plan to build Electron on a virtual machine you will need a fixed-size
|
||||
device container of at least 25 gigabytes in size.
|
||||
|
||||
## Getting the Code
|
||||
|
||||
```bash
|
||||
|
@ -112,8 +108,6 @@ $ ./script/clean.py
|
|||
|
||||
## Troubleshooting
|
||||
|
||||
Make sure you have installed all of the build dependencies.
|
||||
|
||||
### Error While Loading Shared Libraries: libtinfo.so.5
|
||||
|
||||
Prebulit `clang` will try to link to `libtinfo.so.5`. Depending on the host
|
||||
|
@ -128,7 +122,7 @@ $ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5
|
|||
Test your changes conform to the project coding style using:
|
||||
|
||||
```bash
|
||||
$ ./script/cpplint.py
|
||||
$ npm run lint
|
||||
```
|
||||
|
||||
Test functionality using:
|
||||
|
@ -136,3 +130,25 @@ Test functionality using:
|
|||
```bash
|
||||
$ ./script/test.py
|
||||
```
|
||||
|
||||
## Advanced topics
|
||||
|
||||
The default building configuration is targeted for major desktop Linux
|
||||
distributions, to build for a specific distribution or device, following
|
||||
information may help you.
|
||||
|
||||
### Build libchromiumcontent locally
|
||||
|
||||
To avoid using the prebuilt binaries of libchromiumcontent, you can pass the
|
||||
`--build_libchromiumcontent` switch to `bootstrap.py` script:
|
||||
|
||||
```bash
|
||||
$ ./script/bootstrap.py -v --build_libchromiumcontent
|
||||
```
|
||||
|
||||
Note that by default the `shared_library` configuration is not built, so you can
|
||||
only build `Release` version of Electron if you use this mode:
|
||||
|
||||
```bash
|
||||
$ ./script/build.py -c D
|
||||
```
|
||||
|
|
|
@ -65,8 +65,8 @@ And then sign your app with the following script:
|
|||
|
||||
# Name of your app.
|
||||
APP="YourApp"
|
||||
# The path of you app to sign.
|
||||
APP_PATH="/path/to/YouApp.app"
|
||||
# The path of your app to sign.
|
||||
APP_PATH="/path/to/YourApp.app"
|
||||
# The path to the location you want to put the signed package.
|
||||
RESULT_PATH="~/Desktop/$APP.pkg"
|
||||
# The name of certificates you requested.
|
||||
|
|
|
@ -80,45 +80,60 @@ The `main.js` should create windows and handle system events, a typical
|
|||
example being:
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const app = electron.app; // Module to control application life.
|
||||
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
|
||||
const electron = require('electron')
|
||||
// Module to control application life.
|
||||
const app = electron.app
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
var mainWindow = null;
|
||||
let mainWindow
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function() {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform != 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
app.on('ready', function() {
|
||||
function createWindow () {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600})
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||
mainWindow.loadURL('file://' + __dirname + '/index.html')
|
||||
|
||||
// Open the DevTools.
|
||||
mainWindow.webContents.openDevTools();
|
||||
mainWindow.webContents.openDevTools()
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function() {
|
||||
mainWindow.on('closed', function () {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null;
|
||||
});
|
||||
});
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow)
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', function () {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
||||
|
||||
```
|
||||
|
||||
Finally the `index.html` is the web page you want to show:
|
||||
|
@ -147,8 +162,11 @@ working as expected.
|
|||
|
||||
### electron-prebuilt
|
||||
|
||||
If you've installed `electron-prebuilt` globally with `npm`, then you will only
|
||||
need to run the following in your app's source directory:
|
||||
[`electron-prebuilt`](https://github.com/electron-userland/electron-prebuilt) is
|
||||
an `npm` module that contains pre-compiled versions of Electron.
|
||||
|
||||
If you've installed it globally with `npm`, then you will only need to run the
|
||||
following in your app's source directory:
|
||||
|
||||
```bash
|
||||
electron .
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue