From c766f71e768f7cb6cd61f8e837ecf2777f636d00 Mon Sep 17 00:00:00 2001 From: redhoodsu Date: Tue, 28 May 2024 19:03:48 +0800 Subject: [PATCH] release(notification): v0.3.1 --- index.json | 2 +- src/notification/index.ts | 12 ++++++------ src/notification/package.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.json b/index.json index fd216a3..f59ac10 100644 --- a/index.json +++ b/index.json @@ -226,7 +226,7 @@ }, "notification": { "icon": true, - "version": "0.3.0", + "version": "0.3.1", "style": true, "test": true, "install": false, diff --git a/src/notification/index.ts b/src/notification/index.ts index f8deda7..95e0dc9 100644 --- a/src/notification/index.ts +++ b/src/notification/index.ts @@ -4,6 +4,7 @@ import find from 'licia/find' import h from 'licia/h' import Component, { IComponentOptions } from '../share/Component' import { exportCjs } from '../share/util' +import isUndef from 'licia/isUndef' /** IPosition */ export interface IPosition { @@ -16,7 +17,7 @@ export interface IPosition { /** INotifyOptions */ export interface INotifyOptions { /** Notification duration. */ - duration: number + duration?: number /** Notification icon. */ icon?: string } @@ -68,12 +69,11 @@ export default class Notification extends Component { this.initTpl() } /** Show notification. */ - notify( - content: string, - options: INotifyOptions = { - duration: this.options.duration, + notify(content: string, options: INotifyOptions = {}) { + if (isUndef(options.duration)) { + options.duration = this.options.duration } - ) { + const notification = new NotificationItem(this, content, { icon: options.icon || 'none', }) diff --git a/src/notification/package.json b/src/notification/package.json index 977f1bb..3e590c7 100644 --- a/src/notification/package.json +++ b/src/notification/package.json @@ -1,6 +1,6 @@ { "name": "notification", - "version": "0.3.0", + "version": "0.3.1", "description": "Show notifications", "luna": { "icon": true