## electron
https://www.electronjs.org/docs
```
electron: {
clipboard,
nativeImage,
shell,
app,
autoUpdater,
BrowserView,
BrowserWindow,
contentTracing,
crashReporter,
dialog,
globalShortcut,
ipcMain,
inAppPurchase,
Menu,
MenuItem,
net,
netLog,
Notification,
powerMonitor,
powerSaveBlocker,
protocol,
screen,
session,
systemPreferences,
TopLevelWindow,
TouchBar,
Tray,
View,
webContents,
WebContentsView
}
```
## clipboard
| 方法 | 解釋 |
| --- | --- |
| readText() | 讀取剪貼板中的純文本內容 |
| writeText(text) | 作為純文本寫入剪貼板 |
| readHTML() | 剪貼板中的HTML內容 |
| writeHTML(text) | 寫入剪貼板 |
| readImage() | 剪貼板中的圖像內容 |
| writeImage(image) | 寫入剪貼板 |
| readRTF() | 剪貼板中的RTF內容 |
| writeRTF(text) | 向剪貼板中寫入 RTF 格式的`text` |
| readBookmark() | 返回一個對象, 其中包含表示剪貼板中書簽`title`和`url` |
| writeBookmark(text) | 將書簽的`title`和`url`寫入剪貼板 |
| readFindText() | 查找粘貼板上的文本 |
| writeFindText(text) | 純文本形式的內容寫入到find粘貼板 |
| clear() | 清除剪貼板內容 |
| availableFormats() | 剪貼板`type`所支持的格式的數組 |
| has(format) | 剪貼板是否支持指定的`format` |
| read(format) | 從剪貼板中讀取`format`類型的內容 |
| readBuffer(format) | 從剪貼板中讀取`format`類型的內容 |
| writeBuffer(format,buffer) | 將`buffer`作為`format`類型寫入剪貼板 |
| write(data) | 將`data`寫入剪貼板 |
## shell
| 方法 | 解釋 |
| --- | --- |
| showItemInFolder(fullPath) | 在文件管理器中顯示給定的文件。如果可能,請選擇文件 |
| openPath(path) | 返回`Promise<String>`\-如果發生故障,則使用包含與故障相對應的錯誤消息的字符串進行解析,否則為""。以桌面的默認方式打開給定的文件 |
| openExternal(url) | |
| moveItemToTrash(fullPath) | 返回`Boolean`\-項目是否已成功移至垃圾箱或以其他方式刪除。將給定的文件移動到垃圾箱,并返回操作的布爾狀態 |
| beep() | 播放嗶嗶的聲音 |
| writeShortcutLink(shortcutPath) | 返回`Boolean`- 快捷方式是否被成功創建。`shortcutPath`位置創建或更新一個快捷連接 |
| readShortcutLink(shortcutPath) | 返回[`ShortcutDetails`](https://www.electronjs.org/docs/api/structures/shortcut-details)解析`shortcutPath`中的快捷鏈接。發生任何錯誤時將引發異常 |
## autoUpdater
### 事件
| 觸發事件 | 解釋 |
| --- | --- |
| error | 當更新發生錯誤的時候觸發 |
| checking-for-update | 當開始檢查更新的時候觸發 |
| update-available | 有可用更新時發出。該更新將自動下載 |
| update-not-available | 當沒有可用更新的時候觸發 |
| update-downloaded | 在更新下載完成的時候觸發 |
| Event: 'before-quit-for-update' | 此事件是在用戶調用`quitAndInstall()`之后發出的 |
### 方法
| 方法 | 解釋 |
| --- | --- |
| setFeedURL | 設置檢查更新的`url`,并且初始化自動更新 |
| getFeedURL | 返回`String`\- 獲取當前更新的 Feed 鏈接. |
| checkForUpdates | 詢問服務器是否有更新。您必須先調用`setFeedURL`才能使用此API |
| quitAndInstall | 下載更新后,重新啟動應用程序并安裝更新。僅應在`update-downloaded`發出后調用它 |
### BrowserWindow
* `options`Object (可選)
| 參數 | 類型 | 解釋 |
| --- | --- | --- |
| `width` | Integer (可選) | 窗口的寬度(以像素為寬度)。 默認值為`800` |
| `height` | Integer (可選) | 窗口的高度(以像素為單位)。 默認值為`600` |
| `x` | Interger (可選) | (**必選**如果使用了y) 窗口相對于屏幕左側的偏移量。 默認值為將窗口居中。 |
| `y` | Integer (可選) | (**必選**如果使用了x) 窗口相對于屏幕頂端的偏移量。 默認值為將窗口居中。 |
| `useContentSize` | Boolean (可選) | `width`和`height`將設置為 web 頁面的尺寸(譯注: 不包含邊框), 這意味著窗口的實際尺寸將包括窗口邊框的大小,稍微會大一點。 默認值為`false`. |
| `center` | Boolean (可選) | 窗口在屏幕居中. |
| '' | Integer(可選)| 窗口的最小寬度。默認為0 默認值為`0` |
| `minHeight` | Integer (optional) | 窗口的最小高度. 默認值為`0` |
| `maxWidth` | Integer(可選) | 窗口的最大寬度。 默認值不限 |
| `maxHeight` | Integer (optional) | 窗口的最大高度. 默認值不限 |
| `resizable` | Boolean (optional) | 窗口是否可調整大小. 默認值為`true`。 |
| `movable` | Boolean (optional) | 窗口是否可移動。這不是在Linux上實現的. 默認值為`true`。 |
| `minimizable` | Boolean (optional) | 窗口是否可最小化。這不是在Linux上實現的. 默認值為`true`。 |
| `maximizable` | Boolean (optional) | 窗口是否可最大化。這不是在Linux上實現的. 默認值為`true`。 |
| `closable` | Boolean(可選)-窗口是否可關閉。這不是在Linux上實現的。默認值`true`。 |
| `focusable` | Boolean (可選) | 窗口是否可以聚焦. 默認值為`true`。 在 Windows 中設置`focusable: false`也意味著設置了`skipTaskbar: true`. 在 Linux 中設置`focusable: false`時窗口停止與 wm 交互, 并且窗口將始終置頂。 |
| `alwaysOnTop` | Boolean(可選)| 窗口是否應始終位于其他窗口的頂部。默認值`false`。 |
| `fullscreen` | Boolean (可選) | 窗口是否全屏. 當明確設置為`false`時,在 macOS 上全屏的按鈕將被隱藏或禁用. 默認值為`false`. |
| `fullscreenable` | Boolean (可選) | 窗口是否可以進入全屏狀態. 在 macOS上, 最大化/縮放按鈕是否可用 默認值為`true`。 |
| `simpleFullscreen` | Boolean (optional) | 在macOS上使用pre-Lion全屏. 默認值為`false`. |
| `skipTaskbar` | Boolean(可選) | 是否在任務欄中顯示窗口。默認值為`false`。 |
| `kiosk` | Boolean (optional) | 窗口是否處于kiosk模式. 默認值為`false`. |
| `title` | String(可選) | 默認窗口標題 默認為`"Electron"`。 如果由`loadURL()`加載的HTML文件中含有標簽`<title>`,此屬性將被忽略。 |
| `icon`([NativeImage](https://www.electronjs.org/docs/api/native-image) | String) (可選) | 窗口的圖標. 在 Windows 上推薦使用`ICO`圖標來獲得最佳的視覺效果, 默認使用可執行文件的圖標. |
| `show` | Boolean(可選)| 創建窗口時是否應顯示窗口。默認值`true`。 |
| `paintWhenInitiallyHidden` | Boolean(可選) | 當`show`為`false`并且渲染器剛剛被創建時,它是否應激活。 為了讓`document.visibilityState`在`show: false`的情況下第一次加載時正確地工作,你應該把這個設置成`false`. 設置為`false`將會導致`ready-to-show`事件不觸發。 默認值為`true`。 |
| `frame` | Boolean (optional) | Specify`false`to create a[Frameless Window](https://www.electronjs.org/docs/api/frameless-window). 默認值為`true`。 |
| `parent`BrowserWindow(可選) | 指定父窗口。默認值為`null`。 |
| `modal` | Boolean(可選) | 是否為模態窗口。僅當該窗口是子窗口時才有效。默認值`false`。 |
| `acceptFirstMouse` | Boolean(可選)| Web視圖是否接受單個鼠標按下事件同時激活窗口。默認值為`false`。 |
| `disableAutoHideCursor` | Boolean (optional) | Whether to hide cursor when typing. 默認值為`false`. |
| `autoHideMenuBar` | Boolean (optional) | Auto hide the menu bar unless the`Alt`key is pressed. 默認值為`false`. |
| `enableLargerThanScreen` | Boolean (可選) | 是否允許改變窗口的大小使之大于屏幕的尺寸. 僅適用于 macOS,因為其它操作系統默認允許 大于屏幕的窗口。 默認值為`false`. |
| `backgroundColor`String(可選) | 窗口的背景顏色為十六進制值,例如`#66CD00`,`#FFF`,`#80FFFFFF`(設置`transparent`為`true`方可支持alpha屬性,格式為#AARRGGBB)。 默認值為`#FFF`(白色)。|
| `hasShadow` | Boolean (可選) | 窗口是否有陰影. 默認值為`true`。 |
| `opacity`Number (可選) | 設置窗口初始的不透明度, 介于 0.0 (完全透明) 和 1.0 (完全不透明) 之間。 目前僅支持Windows 和 macos |
| `darkTheme` | Boolean (optional) | 強制窗口使用深色主題,只在部分GTK+3桌面環境下有效。 默認值為`false`. |
| `transparent` | Boolean(可選) | 使窗口[透明](https://www.electronjs.org/docs/api/frameless-window#transparent-window)。默認值`false`。在Windows上,除非窗口是無框架的,否則它不起作用。
| `type`String (可選) | 窗口的類型, 默認為普通窗口. 更多信息見下文 |
| `visualEffectState` | 字符串(可選) | 指定材質外觀應如何反映macOS上的窗口活動狀態。必須與該`vibrancy`屬性一起使用。可能的值有 |
* `followWindow`\-當窗口處于活動狀態時,背景應該自動顯示為活動,而當窗口不活動時,背景將不活動。這是默認值。
* `active`\-背景應始終顯示為活動狀態。
* `inactive`\-背景應始終顯示為非活動狀態。
| 參數 | 類型 | 解釋 |
| --- | --- | --- |
| `titleBarStyle` | String (optional) | The style of window title bar. Default is`default`. 可能的值有 |
* `default`\- 標準灰色不透明的Mac標題欄
* `hidden`\- 隱藏標題欄, 內容充滿整個窗口, 但它依然在左上角, 仍然受標準窗口控制.
* `hiddenInset`\- 隱藏標題欄, 顯示小的控制按鈕在窗口邊緣
* `customButtonsOnHover`Boolean (可選) - 在macOS的無框窗口上繪制自定義的關閉與最小化按鈕. 除非鼠標懸停到窗口的左上角, 否則這些按鈕不會顯示出來. 這些自定義的按鈕能防止, 與發生于標準的窗口工具欄按鈕處的鼠標事件相關的問題.**注意:**此選項目前是實驗性的。
| 參數 | 類型 | 解釋 |
| --- | --- | --- |
| `trafficLightPosition` | [Point](https://www.electronjs.org/docs/api/structures/point)(可選) | 為交通信號燈按鈕設置自定義位置。只能搭配使用`titleBarStyle`設置為`hidden` |
| `fullscreenWindowTitle` | Boolean(可選) | 在macOS上以全屏模式在標題欄中顯示所有`titleBarStyle`選項的標題。默認值`false`。 |
| `thickFrame` | Boolean(可選) | 對 Windows 上的無框窗口使用`WS_THICKFRAME`樣式,會增加標準窗口框架。 設置為`false`時將移除窗口的陰影和動畫. 默認值為`true`。 |
| `vibrancy` | String(任選) | 窗口是否使用vibrancy動態效果,僅macOS中有效。可以`appearance-based`,`light`,`dark`,`titlebar`,`selection`,`menu`,`popover`,`sidebar`,`medium-light`,`ultra-dark`,`header`,`sheet`,`window`,`hud`,`fullscreen-ui`,`tooltip`,`content`,`under-window`,或`under-page`。請注意,`frame: false`結合使用鮮艷度值還要求您使用非默認值`titleBarStyle`。還要注意的是`appearance-based`,`light`,`dark`,`medium-light`,和`ultra-dark`已被棄用,并將在MacOS上的一個即將到來的版本中刪除。 |
| `zoomToPageWidth` | Boolean (optional) | Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. 如果為`true`, 窗口將放大到網頁的本身寬度,`false`將使其縮放到屏幕的寬度。 這也會影響直接調用`maximize()`時的行為。 默認值為`false`. |
| `tabbingIdentifier` | String (可選) | 選項組卡的名稱,在macOS 10.12+上可使窗口在原生選項卡中打開. 具有相同標識符的窗口將被組合在一起。 這還會在窗口的標簽欄中添加一個原生的新選項卡按鈕, 并允許`app`和窗口接收`new-window-for-tab`事件。 |
| `webPreferences` | Object(可選)| 網頁功能的設置。 |
> `trafficLightPosition`[點](https://www.electronjs.org/docs/api/structures/point)(可選)-為交通信號燈按鈕設置自定義位置。只能搭配使用`titleBarStyle`設置為`hidden`
> `fullscreenWindowTitle`布爾值(可選)-在macOS上以全屏模式在標題欄中顯示所有`titleBarStyle`選項的標題。默認值`false`。
> `thickFrame`Boolean(可選)-對 Windows 上的無框窗口使用`WS_THICKFRAME`樣式,會增加標準窗口框架。 設置為`false`時將移除窗口的陰影和動畫. 默認值為`true`。
> `vibrancy`String(任選)-窗口是否使用vibrancy動態效果,僅macOS中有效。可以`appearance-based`,`light`,`dark`,`titlebar`,`selection`,`menu`,`popover`,`sidebar`,`medium-light`,`ultra-dark`,`header`,`sheet`,`window`,`hud`,`fullscreen-ui`,`tooltip`,`content`,`under-window`,或`under-page`。請注意,`frame: false`結合使用鮮艷度值還要求您使用非默認值`titleBarStyle`。還要注意的是`appearance-based`,`light`,`dark`,`medium-light`,和`ultra-dark`已被棄用,并將在MacOS上的一個即將到來的版本中刪除。
> `zoomToPageWidth`Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. 如果為`true`, 窗口將放大到網頁的本身寬度,`false`將使其縮放到屏幕的寬度。 這也會影響直接調用`maximize()`時的行為。 默認值為`false`.
> `tabbingIdentifier`String (可選) - 選項組卡的名稱,在macOS 10.12+上可使窗口在原生選項卡中打開. 具有相同標識符的窗口將被組合在一起。 這還會在窗口的標簽欄中添加一個原生的新選項卡按鈕, 并允許`app`和窗口接收`new-window-for-tab`事件。
> `webPreferences`對象(可選)-網頁功能的設置。
> * `devTools`Boolean (可選) - 是否開啟 DevTools. 如果設置為`false`, 則無法使用`BrowserWindow.webContents.openDevTools ()`打開 DevTools。 默認值為`true`。
> * `nodeIntegration`Boolean (optional) - Whether node integration is enabled. 默認值為`false`.
> * `nodeIntegrationInWorker`Boolean (可選) - 是否在Web工作器中啟用了Node集成. 默認值為`false`. 更多內容參見[多線程](https://www.electronjs.org/docs/tutorial/multithreading).
> * `nodeIntegrationInSubFrames`Boolean (可選項)(實驗性),是否允許在子頁面(iframe)或子窗口(child window)中集成Node.js; 預先加載的腳本會被注入到每一個iframe,你可以用`process.isMainFrame`來判斷當前是否處于主框架(main frame)中。
> * `preload`String (可選) -在頁面運行其他腳本之前預先加載指定的腳本 無論頁面是否集成Node, 此腳本都可以訪問所有Node API 腳本路徑為文件的絕對路徑。 當 node integration 關閉時, 預加載的腳本將從全局范圍重新引入node的全局引用標志[參考示例](https://www.electronjs.org/docs/api/process#event-loaded).
> * `sandbox`Boolean (可選)-如果設置該參數, 沙箱的渲染器將與窗口關聯, 使它與Chromium OS-level 的沙箱兼容, 并禁用 Node. js 引擎。 它與`nodeIntegration`的選項不同,且預加載腳本的 API 也有限制.[更多詳情](https://www.electronjs.org/docs/api/sandbox-option).
> * `enableRemoteModule`Boolean (optional) - Whether to enable the[`remote`](https://www.electronjs.org/docs/api/remote)module. 默認值為`false`.
> * `session`[Session](https://www.electronjs.org/docs/api/session#class-session)(可選) - 設置頁面的 session 而不是直接忽略 Session 對象, 也可用`partition`選項來代替,它接受一個 partition 字符串. 同時設置了`session`和`partition`時,`session`的優先級更高. 默認使用默認的 session.
> * `partition`String (optional) - 通過 session 的 partition 字符串來設置界面session. 如果`partition`以`persist:`開頭, 該頁面將使用持續的 session,并在所有頁面生效,且使用同一個`partition`. 如果沒有`persist:`前綴, 頁面將使用 in-memory session. 通過分配相同的`partition`, 多個頁可以共享同一會話。 默認使用默認的 session.
> * `affinity`String (可選) - 當指定,具有相同`affinity`的 web頁面將在相同的渲染進程運行。 需要注意的是,由于渲染過程中會有代碼重用,如`webPreferences`的`preload`,`sandbox`和`nodeIntegration`等選項會在不同頁面之間共用,即使你已經在不同頁面中為同一選項設置過不同的值,它們仍會被共用。 因此,建議為`affinity`相同的頁面,使用相同的`webPreferences`*Deprecated*
> * `zoomFactor`Number (optional) - The default zoom factor of the page,`3.0`represents`300%`. 默認值為`1.0`
> * `javascript`Boolean (optional) - Enables JavaScript support. 默認值為`true`。
> * `webSecurity`Boolean (可選) - 當設置為`false`, 它將禁用同源策略 (通常用來測試網站), 如果此選項不是由開發者設置的,還會把`allowRunningInsecureContent`設置為`true`. 默認值為`true`。
> * `allowRunningInsecureContent`布爾值(可選)-允許https頁面運行來自http URL的JavaScript,CSS或插件。默認值`false`。
> * `images`Boolean (optional) - Enables image support. 默認值為`true`。
> * `textAreasAreResizable`布爾值(可選)-使TextArea元素可調整大小。默認值為`true`。
> * `webgl`Boolean (optional) - Enables WebGL support. 默認值為`true`。
> * `plugins`Boolean (optional) - Whether plugins should be enabled. 默認值為`false`.
> * `experimentalFeatures`Boolean (optional) - Enables Chromium's experimental features. 默認值為`false`.
> * `scrollBounce`Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. 默認值為`false`.
> * `enableBlinkFeatures`String(可選) - 以`逗號`分隔的需要啟用的特性列表,譬如`CSSVariables,KeyboardEventKey`在[RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70)文件中查看被支持的所有特性.
> * `disableBlinkFeatures`String (可選) - 以`,`分隔的禁用特性列表, 如`CSSVariables,KeyboardEventKey`. 在[RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70)文件中查看被支持的所有特性.
> * `defaultFontFamily`對象(可選)-設置字體系列的默認字體。
> > 1. `standard`String (可選) - 默認值為`Times New Roman`.
> > 2. `serif`String (可選) - 默認值為`Times New Roman`.
> > 3. `sansSerif`String (可選) - 默認值為`Arial`.
> > 4. `monospace`String (可選) - 默認值為`Courier New`.
> > 5. `cursive`String (可選) - 默認值為`Script`.
> > 6. `fantasy`String (可選) - 默認值為`Impact`.
> *
> * `defaultFontSize`Integer (可選) - 默認值為`16`.
> * `defaultMonospaceFontSize`Integer (可選) - 默認值為`13`.
> * `minimumFontSize`Integer (可選) - 默認值為`0`.
> * `defaultEncoding`String (可選) - 默認值為`ISO-8859-1`.
> * `backgroundThrottling`Boolean (可選)-是否在頁面成為背景時限制動畫和計時器。 這也會影響到[Page Visibility API](https://www.electronjs.org/docs/api/browser-window#page-visibility). 默認值為`true`。
> * `offscreen`Boolean (optional) - 是否繪制和渲染可視區域外的窗口. 默認值為`false`. 更多詳情, 請參見[offscreen rendering tutorial](https://www.electronjs.org/docs/tutorial/offscreen-rendering)。
> * `contextIsolation`Boolean (可選) - 是否在獨立 JavaScript 環境中運行 Electron API和指定的`preload`腳本. 默認值為`false`.`preload`腳本的運行環境仍然可以訪問`document`和`window`全局變量,但它將使用自己內置的函數 (如`Array`,`Object`,`JSON`等),并且將被加載的頁面與對全局環境所做的任何更改隔離開來. Electron API 僅在`preload`腳本中有效,而不是加載的頁面。 在加載可能不受信任的遠程內容時, 應使用此選項, 以確保加載的內容不能篡改`preload`腳本和使用的 Electron APIs。 此選項使用[Chrome Content Scripts](https://developer.chrome.com/extensions/content_scripts#execution-environment)使用的相同技術。 通過在控制臺選項卡頂部的組合框中選擇 "Electron Isolated Context" 條目, 可以在開發工具中訪問此上下文。
> * `worldSafeExecuteJavaScript`布爾值(可選)-如果為true,`webFrame.executeJavaScript`則從中返回的值將被清除,以確保使用時JS值不會在世界之間不安全地交叉`contextIsolation`。默認值為`false`。在Electron 12中,默認值將更改為`true`。*不推薦使用*
> * `nativeWindowOpen`Boolean (可選) - 是否使用原生的`window.open()`. 默認值為`false`. Child windows will always have node integration disabled unless`nodeIntegrationInSubFrames`is true.**注意:**此選項目前是實驗性的。
> * `webviewTag`Boolean (可選) - 是否啟用[`<webview>`tag](https://www.electronjs.org/docs/api/webview-tag)標簽. 默認值為`false`.**注意:**為`< webview>`配置的`preload`腳本在執行時將啟用節點集成, 因此應確保遠程或不受信任的內容無法創建惡意的`preload`腳本 。 可以使用[webContents](https://www.electronjs.org/docs/api/web-contents)上的`will-attach-webview`事件對`preload`腳本進行剝離, 并驗證或更改`<webview>`的初始設置。
> * `additionalArguments`String\[\] (可選) - 一系列將會被附加至此app的渲染進程的`process.argv`的字符串. 對于將少量數據向下傳至渲染進程的預加載腳本而言是十分實用的.
> * `safeDialogs`Boolean (optional) - Whether to enable browser style consecutive dialog protection. 默認值為`false`.
> * `safeDialogsMessage`String (可選) - 當持續對話框保護被觸發時顯示的消息。 如果沒有定義,那么將使用缺省的消息。注意:當前缺省消息是英文,并沒有本地化。
> * `disableDialogs`Boolean (optional) - Whether to disable dialogs completely. Overrides`safeDialogs`. 默認值為`false`.
> * `navigateOnDragDrop`布爾值(可選)-將文件或鏈接拖放到頁面上是否會導致導航。默認值`false`。
> * `autoplayPolicy`字符串(可選) -自動播放策略應用于內容的窗口,可以`no-user-gesture-required`,`user-gesture-required`,`document-user-activation-required`。默認為`no-user-gesture-required`。
> * `disableHtmlFullscreenWindowResize`布爾值(可選)-輸入HTML全屏時是否阻止窗口調整大小。默認值為`false`。
> * `accessibleTitle`字符串(可選)-僅提供給輔助功能工具(如屏幕閱讀器)的備用標題字符串。該字符串對用戶不直接可見。
> * `spellcheck`Boolean (optional) - Whether to enable the builtin spellchecker. 默認值為`true`。
> * `enableWebSQL`Boolean (optional) - Whether to enable the[WebSQL api](https://www.w3.org/TR/webdatabase/). 默認值為`true`。
> * `v8CacheOptions`字符串(可選)-強制使用眨眼使用的v8代碼緩存策略。接受的值是
> > 1. `none`\-禁用代碼緩存
> > 2. `code`\-基于啟發式的代碼緩存
> > 3. `bypassHeatCheck`\-繞過代碼緩存試探法,但具有延遲編譯
> > 4. `bypassHeatCheckAndEagerCompile`\-與上述相同,只是急于進行編譯。默認策略為`code`。
*~~當使用`minWidth`/`maxWidth`/`minHeight`/`maxHeight`設置最小或最大窗口大小時, 它只限制用戶。 它不會阻止您將不符合大小限制的值傳遞給`setBounds`/`setSize`或`BrowserWindow`的構造函數。~~*
**`type`選項的候選值和行為與平臺相關。 可能的值有**
> 在 Linux 上, 可能的類型有`desktop`、`dock`、`toolbar`、`splash`、`notification`。
> 在 macOS 上,可能的類型是`desktop`,`textured`。
> * `textured`類型增加金屬色澤的外觀 (`NSTexturedBackgroundWindowMask`).
> * `desktop`類型將窗口置于桌面背景級別 (`kCGDesktopWindowLevel - 1`). 注意,桌面窗口不會接收焦點、鍵盤或鼠標事件,但您可以使用 globalShortcut 接收快捷鍵的消息
>
> 在 Windows 上, 可能的類型為`toolbar`.
### contentTracing
```
const { app, contentTracing } = require('electron')
app.whenReady().then(() => {
(async () => {
await contentTracing.startRecording({
included_categories: ['*']
})
console.log('Tracing started')
await new Promise(resolve => setTimeout(resolve, 5000))
const path = await contentTracing.stopRecording()
console.log('Tracing data recorded to ' + path)
})()
})
```
| 方法 | 解釋 |
| --- | --- |
| getCategories | 所有子進程都確認`getCategories`請求后,使用一組類別組進行解析 |
| startRecording | 所有子進程都確認`startRecording`請求后解決。 |
| stopRecording | 在所有子進程都確認`stopRecording`請求后,使用包含所跟蹤數據的文件的路徑進行解析 |
| getTraceBufferUsage | 使用包含`value`和`percentage`的跟蹤緩沖區最大使用量的對象進行解析 |
- electron-vue打包不同平臺的安裝文件
- Electron+Vue開發跨平臺桌面應用
- electron-vue項目初始化process is not defined問題解決
- 出現 require is not defined 的問題
- Cannot read property 'app' of undefined
- electron-vue 隱藏頂部菜單 隱藏導航 、自定義導航
- electron程序顯示在右下角托盤
- electron與vue通信
- electron-vue修改任務欄圖標
- electron-vue文檔1
- 打包錯誤
- 使用 electron 屏幕或攝像頭錄制并保存到本地
- electron-vue創建報錯