Skip to content

Commit

Permalink
fix(script): 修复通知时间很短就消失的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Feb 26, 2024
1 parent 320903f commit cda009f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/utils/tampermonkey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global Tampermonkey GM_getTab */
/* global Tampermonkey GM_getTab GM_notification */

/**
* 油猴封装库
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/projects/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});
Expand Down

0 comments on commit cda009f

Please sign in to comment.