mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 03:52:07 +08:00
demo
This commit is contained in:
@@ -190,7 +190,7 @@ class OsController extends Controller {
|
||||
* 创建系统通知
|
||||
*/
|
||||
sendNotification (args, event) {
|
||||
const { title, subtitle, body, silent, clickEvent, closeEvent} = args;
|
||||
const { title, subtitle, body, silent} = args;
|
||||
|
||||
if (!Notification.isSupported()) {
|
||||
return '当前系统不支持通知';
|
||||
@@ -210,7 +210,7 @@ class OsController extends Controller {
|
||||
options.silent = silent;
|
||||
}
|
||||
|
||||
this.service.os.createNotification(clickEvent, closeEvent, event);
|
||||
this.service.os.createNotification(options, event);
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class OsService extends Service {
|
||||
// electron 实验性功能,慎用
|
||||
this.myBrowserView = new BrowserView();
|
||||
Electron.mainWindow.setBrowserView(this.myBrowserView);
|
||||
myBrowserView.setBounds({
|
||||
this.myBrowserView.setBounds({
|
||||
x: 300,
|
||||
y: 170,
|
||||
width: 650,
|
||||
@@ -45,11 +45,11 @@ class OsService extends Service {
|
||||
/**
|
||||
* createNotification
|
||||
*/
|
||||
createNotification(clickEvent, closeEvent, event) {
|
||||
createNotification(options, event) {
|
||||
const channel = 'controller.os.sendNotification';
|
||||
this.myNotification = new Notification(options);
|
||||
|
||||
if (clickEvent) {
|
||||
if (options.clickEvent) {
|
||||
this.myNotification.on('click', (e) => {
|
||||
let data = {
|
||||
type: 'click',
|
||||
@@ -59,7 +59,7 @@ class OsService extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
if (closeEvent) {
|
||||
if (options.closeEvent) {
|
||||
this.myNotification.on('close', (e) => {
|
||||
let data = {
|
||||
type: 'close',
|
||||
|
||||
Reference in New Issue
Block a user