通过 Electron 托盘(tray)实现后台执⾏⻓任务
Electron 托盘(tray)实现后台执⾏⻓任务。 Electron 应⽤在执⾏⼀些⻓时间任务(⽐如上传、下载),我们想关闭界⾯后任务依旧执⾏。再次打开界⾯,依旧可以看到正在执⾏的任务以及任 务进度。托盘可以帮我们实现这个功能。 创建托盘和菜单示例 实例化 Tray 并传⼊图标路径; 创建菜单并配置到托盘中。 const { app, Menu, Tray } = require('electron') require('electron') let tray = null; // 等同 app.on('read', () => { ... }) app.whenReady().then(() => { tray = new Tray('/path/to/my/icon') const contextMenu = Menu.buildFromTemplate([ { label: { label: 'Item3', type: 'radio', checked: true }, { label: 'Item4', type: 'radio' } ]) tray.setContextMenu(contextMenu) }) 基于托盘功能实现后台运⾏应⽤ 关闭应⽤前唤醒对话框⼆次确认 关闭应⽤时,触发对话框,可⽀持 3 种场景: 点击「取消」取消关闭操作;0 码力 | 6 页 | 1.19 MB | 1 年前3electron中文教程
powerMonitor - 2 - 本文档使用 书栈(BookStack.CN) 构建 powerSaveBlocker protocol session webContents Tray 在渲染进程(网页)内可用的模块 desktopCapturer ipcRenderer remote webFrame 在两种进程中都可用的模块 clipboard crashReporter 8系统下,你需要将你的应用通过一个Application UserModel ID.aspx)安 装到开始屏幕上。需要注意的是,这不是将你的应用固定到开始屏幕。 在Windows 7以及更低的版本中,通知不被支持。不过你可以使用Tray API发送一个"气泡通知"。 此外,通知支持的最大字符长队为250。Windows团队建议通知应该保持在200个字符以下。 通知使用 libnotify 发送,它能在任何支持Desktop globalShortcut ipcMain Menu MenuItem powerMonitor powerSaveBlocker protocol session webContents Tray 在主进程内可用的模块 - 74 - 本文档使用 书栈(BookStack.CN) 构建 app 模块是为了控制整个应用的生命周期设计的。 下面的这个例子将会展示如何在最后一个窗口被关闭时退出应用:0 码力 | 203 页 | 2.72 MB | 1 年前3firebird 5 quickstartguide
application If Firebird is up and running as an application, it is represented by an icon in the system tray: • A green and grey server symbol if controlled by the Guardian; • A round yellow and black graphic reboot is necessary. You can shut the server down via the menu that appears if you right-click on the tray icon. Notice that this also makes the icon disappear; you can restart Firebird via the Start menu firebird processes will always equal the number of client connections plus one. Shutdown via the tray icon menu only terminates the first process (the listener). Other processes, if present, will continue0 码力 | 49 页 | 396.21 KB | 1 年前3Firebird 2 QuickStart
application If Firebird is up and running as an application, it is represented by an icon in the system tray: • A green and grey server symbol if controlled by the Guardian; • A round yellow and black graphic without Guardian. You can shut the server down via the menu that appears if you right-click on the tray icon. Notice that this also makes the icon disappear; you can restart Firebird via the Start menu fb_inet_server processes will always equal the number of client connections plus one. Shutdown via the tray icon menu only terminates the first process (the listener). Other processes, if present, will continue0 码力 | 40 页 | 218.42 KB | 1 年前3Ubuntu Desktop Training 2009
the Fast User Switching topic of this lesson. Figure 2.13. The Fast User Switch Icon The System tray contains the network and sound icons for quick access to network and sound settings. You can check the volume of your computer's speaker. The current date and time is displayed next to the System tray. If you click the date and time, a calendar is displayed. The last icon on the top panel shuts down in the Print dialogue box to define the properties of the printer, such as orientation, the paper tray to be used and the paper size to be printed. 108 Chapter 4. Using OpenOffice.org Applications Ubuntu0 码力 | 428 页 | 57.45 MB | 1 年前3Coexistence Firebird InterBase
net/projects/ibfbcoex/ and get DBServerToggler. This little feller, when started, nestles itself in the System Tray and does all the dirty work for you. You start and stop either server with the click of a button;0 码力 | 8 页 | 48.66 KB | 1 年前3MuPDF 1.22.0 Documentation
• page_size_y= Set the page_size_y field. • separations= Set the separations field. • tray_switch= Set the tray_switch field. • tumble= Set the tumble field. • media_type_num= Set the media_type_num0 码力 | 175 页 | 698.87 KB | 7 月前3Firebird 1.0 QuickStart
be running as an application, monitored by the Guardi- an. The Guardian's icon should appear in the tray with a green graphic. If the icon is flashing or show- ing as a red graphic, it indicates that Guardian0 码力 | 26 页 | 179.05 KB | 1 年前3openEuler 21.03 技术白皮书
taskbar displayed at the bottom of the desktop. It consists of the launcher, application icons, tray, and system plug-ins. Developers can open, create, close, or exit an application, set the volume,0 码力 | 21 页 | 948.66 KB | 1 年前3MuPDF 1.23.0 Documentation
• page_size_y= Set the page_size_y field. • separations= Set the separations field. • tray_switch= Set the tray_switch field. • tumble= Set the tumble field. • media_type_num= Set the media_type_num0 码力 | 245 页 | 817.74 KB | 7 月前3
共 186 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19