Merge remote-tracking branch 'refs/remotes/atom/master'
This commit is contained in:
commit
43b73a0ced
24 changed files with 175 additions and 54 deletions
|
@ -5,7 +5,6 @@
|
||||||
#include "atom/app/atom_main.h"
|
#include "atom/app/atom_main.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -36,10 +35,33 @@
|
||||||
#include "base/at_exit.h"
|
#include "base/at_exit.h"
|
||||||
#include "base/i18n/icu_util.h"
|
#include "base/i18n/icu_util.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const char* kRunAsNode = "ELECTRON_RUN_AS_NODE";
|
||||||
|
const char* kOldRunAsNode = "ATOM_SHELL_INTERNAL_RUN_AS_NODE";
|
||||||
|
|
||||||
|
bool IsEnvSet(const char* name) {
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
size_t required_size;
|
||||||
|
getenv_s(&required_size, nullptr, 0, name);
|
||||||
|
return required_size != 0;
|
||||||
|
#else
|
||||||
|
char* indicator = getenv(name);
|
||||||
|
return indicator && indicator[0] != '\0';
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsRunAsNode() {
|
||||||
|
return IsEnvSet(kRunAsNode) || IsEnvSet(kOldRunAsNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
bool IsCygwin() {
|
||||||
|
std::string os;
|
||||||
|
scoped_ptr<base::Environment> env(base::Environment::Create());
|
||||||
|
return env->GetVar("OS", &os) && os == "cygwin";
|
||||||
|
}
|
||||||
|
|
||||||
// Win8.1 supports monitor-specific DPI scaling.
|
// Win8.1 supports monitor-specific DPI scaling.
|
||||||
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||||
typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
typedef HRESULT(WINAPI *SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
||||||
|
@ -77,24 +99,22 @@ void EnableHighDPISupport() {
|
||||||
SetProcessDPIAwareWrapper();
|
SetProcessDPIAwareWrapper();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
wchar_t** wargv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
||||||
|
|
||||||
scoped_ptr<base::Environment> env(base::Environment::Create());
|
|
||||||
|
|
||||||
// Make output work in console if we are not in cygiwn.
|
// Make output work in console if we are not in cygiwn.
|
||||||
std::string os;
|
if (!IsCygwin() && !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE")) {
|
||||||
if (env->GetVar("OS", &os) && os != "cygwin") {
|
|
||||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||||
|
|
||||||
FILE* dontcare;
|
FILE* dontcare;
|
||||||
freopen_s(&dontcare, "CON", "w", stdout);
|
freopen_s(&dontcare, "CON", "w", stdout);
|
||||||
freopen_s(&dontcare, "CON", "w", stderr);
|
freopen_s(&dontcare, "CON", "w", stderr);
|
||||||
freopen_s(&dontcare, "CON", "r", stdin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert argv to to UTF8
|
// Convert argv to to UTF8
|
||||||
|
@ -131,16 +151,12 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string node_indicator, crash_service_indicator;
|
if (IsRunAsNode()) {
|
||||||
if (env->GetVar("ATOM_SHELL_INTERNAL_RUN_AS_NODE", &node_indicator) &&
|
|
||||||
node_indicator == "1") {
|
|
||||||
// Now that argv conversion is done, we can finally start.
|
// Now that argv conversion is done, we can finally start.
|
||||||
base::AtExitManager atexit_manager;
|
base::AtExitManager atexit_manager;
|
||||||
base::i18n::InitializeICU();
|
base::i18n::InitializeICU();
|
||||||
return atom::NodeMain(argc, argv);
|
return atom::NodeMain(argc, argv);
|
||||||
} else if (env->GetVar("ATOM_SHELL_INTERNAL_CRASH_SERVICE",
|
} else if (IsEnvSet("ATOM_SHELL_INTERNAL_CRASH_SERVICE")) {
|
||||||
&crash_service_indicator) &&
|
|
||||||
crash_service_indicator == "1") {
|
|
||||||
return crash_service::Main(cmd);
|
return crash_service::Main(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +180,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
|
||||||
#elif defined(OS_LINUX) // defined(OS_WIN)
|
#elif defined(OS_LINUX) // defined(OS_WIN)
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
if (IsRunAsNode()) {
|
||||||
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
|
||||||
base::i18n::InitializeICU();
|
base::i18n::InitializeICU();
|
||||||
base::AtExitManager atexit_manager;
|
base::AtExitManager atexit_manager;
|
||||||
return atom::NodeMain(argc, const_cast<char**>(argv));
|
return atom::NodeMain(argc, const_cast<char**>(argv));
|
||||||
|
@ -182,8 +197,7 @@ int main(int argc, const char* argv[]) {
|
||||||
#else // defined(OS_LINUX)
|
#else // defined(OS_LINUX)
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
|
if (IsRunAsNode()) {
|
||||||
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
|
|
||||||
return AtomInitializeICUandStartNode(argc, const_cast<char**>(argv));
|
return AtomInitializeICUandStartNode(argc, const_cast<char**>(argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ deprecate.event app, 'finish-launching', 'ready', ->
|
||||||
setImmediate => # give default app a chance to setup default menu.
|
setImmediate => # give default app a chance to setup default menu.
|
||||||
@emit 'finish-launching'
|
@emit 'finish-launching'
|
||||||
deprecate.event app, 'activate-with-no-open-windows', 'activate', (event, hasVisibleWindows) ->
|
deprecate.event app, 'activate-with-no-open-windows', 'activate', (event, hasVisibleWindows) ->
|
||||||
@emit 'activate-with-no-open-windows' if not hasVisibleWindows
|
@emit 'activate-with-no-open-windows', event if not hasVisibleWindows
|
||||||
deprecate.event app, 'select-certificate', 'select-client-certificate'
|
deprecate.event app, 'select-certificate', 'select-client-certificate'
|
||||||
|
|
||||||
# Wrappers for native classes.
|
# Wrappers for native classes.
|
||||||
|
|
|
@ -90,16 +90,18 @@ deprecate.member BrowserWindow, 'copy', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'paste', 'webContents'
|
deprecate.member BrowserWindow, 'paste', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'selectAll', 'webContents'
|
deprecate.member BrowserWindow, 'selectAll', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents'
|
deprecate.member BrowserWindow, 'reloadIgnoringCache', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'getPageTitle', 'webContents'
|
|
||||||
deprecate.member BrowserWindow, 'isLoading', 'webContents'
|
deprecate.member BrowserWindow, 'isLoading', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'isWaitingForResponse', 'webContents'
|
deprecate.member BrowserWindow, 'isWaitingForResponse', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'stop', 'webContents'
|
deprecate.member BrowserWindow, 'stop', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'isCrashed', 'webContents'
|
deprecate.member BrowserWindow, 'isCrashed', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'executeJavaScriptInDevTools', 'webContents'
|
|
||||||
deprecate.member BrowserWindow, 'print', 'webContents'
|
deprecate.member BrowserWindow, 'print', 'webContents'
|
||||||
deprecate.member BrowserWindow, 'printToPDF', 'webContents'
|
deprecate.member BrowserWindow, 'printToPDF', 'webContents'
|
||||||
deprecate.rename BrowserWindow, 'restart', 'reload'
|
deprecate.rename BrowserWindow, 'restart', 'reload'
|
||||||
deprecate.rename BrowserWindow, 'loadUrl', 'loadURL'
|
deprecate.rename BrowserWindow, 'loadUrl', 'loadURL'
|
||||||
deprecate.rename BrowserWindow, 'getUrl', 'getURL'
|
deprecate.rename BrowserWindow, 'getUrl', 'getURL'
|
||||||
|
BrowserWindow::executeJavaScriptInDevTools = deprecate 'executeJavaScriptInDevTools', 'devToolsWebContents.executeJavaScript', (code) ->
|
||||||
|
@devToolsWebContents?.executeJavaScript code
|
||||||
|
BrowserWindow::getPageTitle = deprecate 'getPageTitle', 'webContents.getTitle', ->
|
||||||
|
@webContents?.getTitle()
|
||||||
|
|
||||||
module.exports = BrowserWindow
|
module.exports = BrowserWindow
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{deprecate, ipcMain} = require 'electron'
|
{deprecate, ipcMain} = require 'electron'
|
||||||
|
|
||||||
# This module is deprecated, we mirror everything from ipcMain.
|
# This module is deprecated, we mirror everything from ipcMain.
|
||||||
deprecate.warn 'ipc module', 'ipcMain module'
|
deprecate.warn 'ipc module', 'require("electron").ipcMain'
|
||||||
|
|
||||||
module.exports = ipcMain
|
module.exports = ipcMain
|
||||||
|
|
|
@ -107,7 +107,7 @@ unwrapArgs = (sender, args) ->
|
||||||
# style function and the caller didn't pass a callback.
|
# style function and the caller didn't pass a callback.
|
||||||
callFunction = (event, func, caller, args) ->
|
callFunction = (event, func, caller, args) ->
|
||||||
funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous')
|
funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous')
|
||||||
funcPassedCallback = args[args.length - 1] is 'function'
|
funcPassedCallback = typeof args[args.length - 1] is 'function'
|
||||||
|
|
||||||
try
|
try
|
||||||
if funcMarkedAsync and not funcPassedCallback
|
if funcMarkedAsync and not funcPassedCallback
|
||||||
|
@ -221,3 +221,11 @@ ipcMain.on 'ATOM_BROWSER_GUEST_WEB_CONTENTS', (event, guestInstanceId) ->
|
||||||
|
|
||||||
ipcMain.on 'ATOM_BROWSER_LIST_MODULES', (event) ->
|
ipcMain.on 'ATOM_BROWSER_LIST_MODULES', (event) ->
|
||||||
event.returnValue = (name for name of electron)
|
event.returnValue = (name for name of electron)
|
||||||
|
|
||||||
|
ipcMain.on 'ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', (event, guestInstanceId, method, args...) ->
|
||||||
|
try
|
||||||
|
guestViewManager = require './guest-view-manager'
|
||||||
|
guest = guestViewManager.getGuest(guestInstanceId)
|
||||||
|
guest[method].apply(guest, args)
|
||||||
|
catch e
|
||||||
|
event.returnValue = exceptionToMeta e
|
||||||
|
|
|
@ -192,6 +192,11 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
|
|
||||||
- (void)windowWillClose:(NSNotification*)notification {
|
- (void)windowWillClose:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowClosed();
|
shell_->NotifyWindowClosed();
|
||||||
|
|
||||||
|
// Clears the delegate when window is going to be closed, since EL Capitan it
|
||||||
|
// is possible that the methods of delegate would get called after the window
|
||||||
|
// has been closed.
|
||||||
|
[shell_->GetNativeWindow() setDelegate:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)window {
|
- (BOOL)windowShouldClose:(id)window {
|
||||||
|
|
|
@ -181,6 +181,11 @@ void URLRequestFetchJob::Kill() {
|
||||||
bool URLRequestFetchJob::ReadRawData(net::IOBuffer* dest,
|
bool URLRequestFetchJob::ReadRawData(net::IOBuffer* dest,
|
||||||
int dest_size,
|
int dest_size,
|
||||||
int* bytes_read) {
|
int* bytes_read) {
|
||||||
|
if (GetResponseCode() == 204) {
|
||||||
|
*bytes_read = 0;
|
||||||
|
request()->set_received_response_content_length(prefilter_bytes_read());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
pending_buffer_ = dest;
|
pending_buffer_ = dest;
|
||||||
pending_buffer_size_ = dest_size;
|
pending_buffer_size_ = dest_size;
|
||||||
SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
|
SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
|
||||||
|
@ -207,6 +212,14 @@ int URLRequestFetchJob::GetResponseCode() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLRequestFetchJob::OnURLFetchComplete(const net::URLFetcher* source) {
|
void URLRequestFetchJob::OnURLFetchComplete(const net::URLFetcher* source) {
|
||||||
|
if (!response_info_) {
|
||||||
|
// Since we notify header completion only after first write there will be
|
||||||
|
// no response object constructed for http respones with no content 204.
|
||||||
|
// We notify header completion here.
|
||||||
|
HeadersCompleted();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pending_buffer_ = nullptr;
|
pending_buffer_ = nullptr;
|
||||||
pending_buffer_size_ = 0;
|
pending_buffer_size_ = 0;
|
||||||
NotifyDone(fetcher_->GetStatus());
|
NotifyDone(fetcher_->GetStatus());
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{EventEmitter} = require 'events'
|
{EventEmitter} = require 'events'
|
||||||
|
|
||||||
# This module is deprecated, we mirror everything from ipcRenderer.
|
# This module is deprecated, we mirror everything from ipcRenderer.
|
||||||
deprecate.warn 'ipc module', 'ipcRenderer module'
|
deprecate.warn 'ipc module', 'require("electron").ipcRenderer'
|
||||||
|
|
||||||
# Routes events of ipcRenderer.
|
# Routes events of ipcRenderer.
|
||||||
ipc = new EventEmitter
|
ipc = new EventEmitter
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{deprecate, webFrame, remote} = require 'electron'
|
{deprecate, webFrame, remote, ipcRenderer} = require 'electron'
|
||||||
v8Util = process.atomBinding 'v8_util'
|
v8Util = process.atomBinding 'v8_util'
|
||||||
|
|
||||||
guestViewInternal = require './guest-view-internal'
|
guestViewInternal = require './guest-view-internal'
|
||||||
|
@ -270,8 +270,6 @@ registerWebViewElement = ->
|
||||||
'isCrashed'
|
'isCrashed'
|
||||||
'setUserAgent'
|
'setUserAgent'
|
||||||
'getUserAgent'
|
'getUserAgent'
|
||||||
'executeJavaScript'
|
|
||||||
'insertCSS'
|
|
||||||
'openDevTools'
|
'openDevTools'
|
||||||
'closeDevTools'
|
'closeDevTools'
|
||||||
'isDevToolsOpened'
|
'isDevToolsOpened'
|
||||||
|
@ -289,20 +287,32 @@ registerWebViewElement = ->
|
||||||
'unselect'
|
'unselect'
|
||||||
'replace'
|
'replace'
|
||||||
'replaceMisspelling'
|
'replaceMisspelling'
|
||||||
'send'
|
|
||||||
'getId'
|
'getId'
|
||||||
'inspectServiceWorker'
|
'inspectServiceWorker'
|
||||||
'print'
|
'print'
|
||||||
'printToPDF'
|
'printToPDF'
|
||||||
'sendInputEvent'
|
]
|
||||||
|
|
||||||
|
nonblockMethods = [
|
||||||
|
'send',
|
||||||
|
'sendInputEvent',
|
||||||
|
'executeJavaScript',
|
||||||
|
'insertCSS'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Forward proto.foo* method calls to WebViewImpl.foo*.
|
# Forward proto.foo* method calls to WebViewImpl.foo*.
|
||||||
createHandler = (m) ->
|
createBlockHandler = (m) ->
|
||||||
(args...) ->
|
(args...) ->
|
||||||
internal = v8Util.getHiddenValue this, 'internal'
|
internal = v8Util.getHiddenValue this, 'internal'
|
||||||
internal.webContents[m] args...
|
internal.webContents[m] args...
|
||||||
proto[m] = createHandler m for m in methods
|
proto[m] = createBlockHandler m for m in methods
|
||||||
|
|
||||||
|
createNonBlockHandler = (m) ->
|
||||||
|
(args...) ->
|
||||||
|
internal = v8Util.getHiddenValue this, 'internal'
|
||||||
|
ipcRenderer.send('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', internal.guestInstanceId, m, args...)
|
||||||
|
|
||||||
|
proto[m] = createNonBlockHandler m for m in nonblockMethods
|
||||||
|
|
||||||
# Deprecated.
|
# Deprecated.
|
||||||
deprecate.rename proto, 'getUrl', 'getURL'
|
deprecate.rename proto, 'getUrl', 'getURL'
|
||||||
|
|
|
@ -25,7 +25,7 @@ var window = null;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
window = new BrowserWindow({width: 800, height: 600});
|
window = new BrowserWindow({width: 800, height: 600});
|
||||||
window.loadUrl('https://github.com');
|
window.loadURL('https://github.com');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ También puedes mostrar una página web contenida en un `asar` utilizando `Brows
|
||||||
```javascript
|
```javascript
|
||||||
var BrowserWindow = require('browser-window');
|
var BrowserWindow = require('browser-window');
|
||||||
var win = new BrowserWindow({width: 800, height: 600});
|
var win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.loadUrl('file:///path/to/example.asar/static/index.html');
|
win.loadURL('file:///path/to/example.asar/static/index.html');
|
||||||
```
|
```
|
||||||
|
|
||||||
### API Web
|
### API Web
|
||||||
|
|
|
@ -12,7 +12,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('online-status-changed', function(event, status) {
|
ipc.on('online-status-changed', function(event, status) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ app.on('ready', function() {
|
||||||
'plugins': true
|
'plugins': true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
// Something else
|
// Something else
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -71,7 +71,7 @@ Você também pode renderizar uma página web apartir de um arquivo `asar` utili
|
||||||
```javascript
|
```javascript
|
||||||
var BrowserWindow = require('browser-window');
|
var BrowserWindow = require('browser-window');
|
||||||
var win = new BrowserWindow({width: 800, height: 600});
|
var win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.loadUrl('file:///path/to/example.asar/static/index.html');
|
win.loadURL('file:///path/to/example.asar/static/index.html');
|
||||||
```
|
```
|
||||||
|
|
||||||
### API Web
|
### API Web
|
||||||
|
|
|
@ -13,7 +13,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('online-status-changed', function(event, status) {
|
ipc.on('online-status-changed', function(event, status) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ app.on('ready', function() {
|
||||||
'plugins': true
|
'plugins': true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
// Algo mais
|
// Algo mais
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,7 +9,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
````
|
````
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('online-status-changed', function(event, status) {
|
ipc.on('online-status-changed', function(event, status) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ var window = null;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
window = new BrowserWindow({width: 800, height: 600});
|
window = new BrowserWindow({width: 800, height: 600});
|
||||||
window.loadUrl('https://github.com');
|
window.loadURL('https://github.com');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ var onlineStatusWindow;
|
||||||
|
|
||||||
app.on('ready', function() {
|
app.on('ready', function() {
|
||||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||||
onlineStatusWindow.loadUrl('file://' + __dirname + '/online-status.html');
|
onlineStatusWindow.loadURL('file://' + __dirname + '/online-status.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('online-status-changed', function(event, status) {
|
ipc.on('online-status-changed', function(event, status) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ select the tag that matches your version.
|
||||||
* [Synopsis](api/synopsis.md)
|
* [Synopsis](api/synopsis.md)
|
||||||
* [Process Object](api/process.md)
|
* [Process Object](api/process.md)
|
||||||
* [Supported Chrome Command Line Switches](api/chrome-command-line-switches.md)
|
* [Supported Chrome Command Line Switches](api/chrome-command-line-switches.md)
|
||||||
|
* [Environment Variables](api/environment-variables.md)
|
||||||
|
|
||||||
### Custom DOM Elements:
|
### Custom DOM Elements:
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ the `will-quit` and `window-all-closed` events.
|
||||||
|
|
||||||
Emitted when the application is quitting.
|
Emitted when the application is quitting.
|
||||||
|
|
||||||
### Event: 'open-file'
|
### Event: 'open-file' _OS X_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
@ -82,7 +82,9 @@ handle this case (even before the `ready` event is emitted).
|
||||||
|
|
||||||
You should call `event.preventDefault()` if you want to handle this event.
|
You should call `event.preventDefault()` if you want to handle this event.
|
||||||
|
|
||||||
### Event: 'open-url'
|
On Windows, you have to parse `process.argv` to get the filepath.
|
||||||
|
|
||||||
|
### Event: 'open-url' _OS X_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Supported Chrome command line switches
|
# Supported Chrome command line switches
|
||||||
|
|
||||||
This page lists the command line switches used by the Chrome browser that are also supported by
|
This page lists the command line switches used by the Chrome browser that are
|
||||||
Electron. You can use [app.commandLine.appendSwitch][append-switch] to append
|
also supported by Electron. You can use
|
||||||
them in your app's main script before the [ready][ready] event of [app][app]
|
[app.commandLine.appendSwitch][append-switch] to append them in your app's main
|
||||||
module is emitted:
|
script before the [ready][ready] event of [app][app] module is emitted:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const app = require('electron').app;
|
const app = require('electron').app;
|
||||||
|
@ -47,6 +47,22 @@ only affects requests with HTTP protocol, including HTTPS and WebSocket
|
||||||
requests. It is also noteworthy that not all proxy servers support HTTPS and
|
requests. It is also noteworthy that not all proxy servers support HTTPS and
|
||||||
WebSocket requests.
|
WebSocket requests.
|
||||||
|
|
||||||
|
## --proxy-bypass-list=`hosts`
|
||||||
|
|
||||||
|
Instructs Electron to bypass the proxy server for the given semi-colon-separated
|
||||||
|
list of hosts. This flag has an effect only if used in tandem with
|
||||||
|
`--proxy-server`.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')`
|
||||||
|
```
|
||||||
|
|
||||||
|
Will use the proxy server for all hosts except for local addresses (`localhost`,
|
||||||
|
`127.0.0.1` etc.), `google.com` subdomains, hosts that contain the suffix
|
||||||
|
`foo.com` and anything at `1.2.3.4:5678`.
|
||||||
|
|
||||||
## --proxy-pac-url=`url`
|
## --proxy-pac-url=`url`
|
||||||
|
|
||||||
Uses the PAC script at the specified `url`.
|
Uses the PAC script at the specified `url`.
|
||||||
|
|
50
docs/api/environment-variables.md
Normal file
50
docs/api/environment-variables.md
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# Environment variables
|
||||||
|
|
||||||
|
Some behaviors of Electron are controlled by environment variables, because they
|
||||||
|
are initialized earlier than command line and the app's code.
|
||||||
|
|
||||||
|
Examples on POSIX shells:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ export ELECTRON_ENABLE_LOGGING=true
|
||||||
|
$ electron
|
||||||
|
```
|
||||||
|
|
||||||
|
on Windows console:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
> set ELECTRON_ENABLE_LOGGING=true
|
||||||
|
> electron
|
||||||
|
```
|
||||||
|
|
||||||
|
## `ELECTRON_RUN_AS_NODE`
|
||||||
|
|
||||||
|
Starts the process as a normal Node.js process.
|
||||||
|
|
||||||
|
## `ELECTRON_ENABLE_LOGGING`
|
||||||
|
|
||||||
|
Prints Chrome's internal logging to console.
|
||||||
|
|
||||||
|
## `ELECTRON_ENABLE_STACK_DUMPING`
|
||||||
|
|
||||||
|
When Electron crashed, prints the stack trace to console.
|
||||||
|
|
||||||
|
This environment variable will not work if `crashReporter` is started.
|
||||||
|
|
||||||
|
## `ELECTRON_DEFAULT_ERROR_MODE` _Windows_
|
||||||
|
|
||||||
|
Shows Windows's crash dialog when Electron crashed.
|
||||||
|
|
||||||
|
This environment variable will not work if `crashReporter` is started.
|
||||||
|
|
||||||
|
## `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
|
||||||
|
|
||||||
|
Don't attach to current console session.
|
||||||
|
|
||||||
|
## `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
|
||||||
|
|
||||||
|
Don't use global menu bar on Linux.
|
||||||
|
|
||||||
|
## `ELECTRON_HIDE_INTERNAL_MODULES`
|
||||||
|
|
||||||
|
Turns off compatibility mode for old built-in modules like `require('ipc')`.
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit d4fab33427eb728a553896527f1931887ce6d9d9
|
Subproject commit 57842edb817cc1ae38a02fd7f266dd6aa3afbb45
|
Loading…
Add table
Reference in a new issue