Merge pull request #7654 from scotttrinh/flash-frame-doc
📝 Add flashFrame to desktop env integration
This commit is contained in:
commit
c90d4abcf0
1 changed files with 24 additions and 0 deletions
|
@ -306,6 +306,29 @@ let win = new BrowserWindow()
|
|||
win.setOverlayIcon('path/to/overlay.png', 'Description for overlay')
|
||||
```
|
||||
|
||||
## Flash Frame (Windows)
|
||||
|
||||
On Windows you can highlight the taskbar button to get the user's attention.
|
||||
This is similar to bouncing the dock icon on macOS.
|
||||
From the MSDN reference documentation:
|
||||
|
||||
> Typically, a window is flashed to inform the user that the window requires
|
||||
> attention but that it does not currently have the keyboard focus.
|
||||
|
||||
To flash the BrowserWindow taskbar button, you can use the
|
||||
[BrowserWindow.flashFrame][flashframe] API:
|
||||
|
||||
```javascript
|
||||
const {BrowserWindow} = require('electron')
|
||||
let win = new BrowserWindow()
|
||||
win.once('focus', () => win.flashFrame(false))
|
||||
win.flashFrame(true)
|
||||
```
|
||||
|
||||
Don't forget to call the `flashFrame` method with `false` to turn off the flash. In
|
||||
the above example, it is called when the window comes into focus, but you might
|
||||
use a timeout or some other event to disable it.
|
||||
|
||||
## Represented File of Window (macOS)
|
||||
|
||||
On macOS a window can set its represented file, so the file's icon can show in
|
||||
|
@ -373,3 +396,4 @@ ipcMain.on('ondragstart', (event, filePath) => {
|
|||
[tray-balloon]: ../api/tray.md#traydisplayballoonoptions-windows
|
||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||
[notification-spec]: https://developer.gnome.org/notification-spec/
|
||||
[flashframe]: ../api/browser-window.md#winflashframeflag
|
||||
|
|
Loading…
Reference in a new issue