diff --git a/packages/core/src/utils/tampermonkey.ts b/packages/core/src/utils/tampermonkey.ts index b3a35c41..8ef5a5c1 100644 --- a/packages/core/src/utils/tampermonkey.ts +++ b/packages/core/src/utils/tampermonkey.ts @@ -1,4 +1,4 @@ -/* global Tampermonkey GM_getTab */ +/* global Tampermonkey GM_getTab GM_notification */ /** * 油猴封装库 @@ -48,7 +48,7 @@ export const $gm = { ) { const { onclick, ondone, important, duration = 30, silent = true, extraTitle = '' } = options || {}; const { icon, name } = $gm.getInfos()?.script || {}; - // eslint-disable-next-line no-undef + GM_notification({ title: name + (extraTitle ? '-' + extraTitle : ''), text: content, diff --git a/packages/scripts/src/projects/common.ts b/packages/scripts/src/projects/common.ts index 8d0a9539..fe8897b8 100644 --- a/packages/scripts/src/projects/common.ts +++ b/packages/scripts/src/projects/common.ts @@ -502,7 +502,7 @@ export const CommonProject = Project.create({ if (this.cfg.notification !== 'no-notify') { $gm.notification(content, { extraTitle: opts?.extraTitle, - duration: opts?.duration || 30, + duration: opts?.duration ?? 30, important: this.cfg.notification === 'all', silent: this.cfg.notification === 'only-notify' });