支持的命令行开关
您可以在 模块的ready事件生效之前,使用将它们附加到您的应用程序的主要脚本中:
启用了集成身份验证的以逗号分隔的服务器列表。
例如:
则任何以example.com
, foobar.com
, baz
结尾的url
, 都需要考虑集成验证. Without *
prefix the URL has to match exactly.
A comma-separated list of servers for which delegation of user credentials is required. Without *
prefix the URL has to match exactly.
Disables NTLM v2 for posix platforms, no effect elsewhere.
禁用HTTP请求的磁盘缓存.
禁用HTTP/2和SPDY/3.1协议.
防止Chromium降低不可见的页面渲染进程的优先级.
这个标识是全局的, 影响所有渲染进程. 如果你只想禁用一个窗口的节流保护,你可以采取playing silent audio.
--disk-cache-size=size
强制磁盘缓存使用的最大磁盘空间(以字节为单位)。
--enable-api-filtering-logging
Enables caller stack logging for the following APIs (filtering events):
desktopCapturer.getSources()
/desktop-capturer-get-sources
remote.require()
/remote-require
remote.getGlobal()
/remote-get-builtin
- /
remote-get-global
remote.getCurrentWindow()
/remote-get-current-window
remote.getCurrentWebContents()
/remote-get-current-web-contents
--enable-logging
在控制台打印Chromium日志.
这个开关不能用于app.commandLine.appendSwitch
, 因为它在用户应用程序加载之前就被解析了, 但是你可以设置ELECTRON_ENABLE_LOGGING
环境变量来达到同样的效果.
--host-rules=rules
以逗号分隔的rules
列表,用于控制主机名的映射方式
例如:
MAP * 127.0.0.1
强制将所有主机名映射到127.0.0.1MAP *.google.com proxy
强制所有google.com子域名解析到”proxy”.MAP test.com [::1]:77
Forces “test.com” to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.
与--host-rules
类似, 但是这些rules
仅适用于主机解析器.
--ignore-certificate-errors
忽略证书相关的错误.
--ignore-connections-limit=domains
忽略由,
分割的domains
列表的连接限制.
--js-flags=flags
Specifies the flags passed to the Node.js engine. It has to be passed when starting Electron if you want to enable the flags
in the main process.
See the or run node --help
in your terminal for a list of available flags. Additionally, run node --v8-options
to see a list of flags that specifically refer to Node.js’s V8 JavaScript engine.
设置系统语言环境
启用需要保存的网络日志事件并将其写入path
路径下.
Don’t use a proxy server and always make direct connections. Overrides any other proxy server flags that are passed.
Disables Chromium sandbox, which is now enabled by default. Should only be used for testing.
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 .
例如:
上面的代码, 除了本地地址(localhost
,127.0.0.1
等等.), google.com
子域名, 包含foo.com
后缀的主机地址, 以及任何在1.2.3.4:5678
上的地址以外的所有主机都将使用代理服务器.
在指定url
中使用PAC脚本.
使用指定的覆盖系统设置的代理服务器. 这个开关只影响HTTP协议请求, 包括HTTPS和WebSocket请求. 值得注意的是并不是所有的代理服务器都支持HTTPS和WebSocket请求. 代理 URL 不支持用户名和密码认证方式 Chromium 的问题。
--remote-debugging-port=port
在指定端口
开启HTTP远程调试.
--v=log_level
Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.
--vmodule=pattern
给定每个模块最大的V-logging等级, 覆盖--v
设定的值. 例如, my_module=2,foo*=3
将改变所有my_module.*
和foo*.*
源文件的代码的日志等级.
任何包含正斜杠或反斜杠的模式都将针对 整个路径名进行测试,而不仅仅是模块。 例如, */foo/bar/*=2
会改变foo/bar
目录下源文件的所有代码的日志等级.
这个开关只有在--enable-logging
也被传递时才起效.
--force_high_performance_gpu
Force using discrete GPU when there are multiple GPUs available.
--force_low_power_gpu
Force using integrated GPU when there are multiple GPUs available.
Node.js Flags
Electron supports some of the supported by Node.js.
Note: Passing unsupported command line switches to Electron when it is not running in ELECTRON_RUN_AS_NODE
will have no effect.
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
Aliased to --debug-brk=[host:]port
.
Set the host:port
to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is 127.0.0.1
.
Aliased to --debug-port=[host:]port
.
Activate inspector on host:port
. Default is 127.0.0.1:9229
.
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the Chrome DevTools Protocol.
调试相关的标识, 更多详细信息请查看 指南。
Aliased to --debug[=[host:]port
.
Specify ways of the inspector web socket url exposure.