For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/lynxtron/api/@lynx-js/lynxtron/Class.Notification.md.
  • 简体中文
  • @lynx-js/lynxtron / Notification

    Notification

    继承

    • unknown

    构造函数

    new Notification()

    new Notification(options?: NotificationConstructorOptions): Notification

    参数

    范围类型
    options?NotificationConstructorOptions

    返回

    Notification

    重写了

    EventEmitter.constructor

    定义于

    apis/api/notification.d.ts:148

    属性

    actions

    actions: NotificationAction[];

    A NotificationAction[] property representing the actions of the notification.

    定义于

    apis/api/notification.d.ts:98


    body

    body: string;

    A string property representing the body of the notification.

    定义于

    apis/api/notification.d.ts:102


    closeButtonText

    closeButtonText: string;

    A string property representing the close button text of the notification.

    定义于

    apis/api/notification.d.ts:106


    hasReply

    hasReply: boolean;

    A boolean property representing whether the notification has a reply action.

    定义于

    apis/api/notification.d.ts:110


    replyPlaceholder

    replyPlaceholder: string;

    A string property representing the reply placeholder of the notification.

    定义于

    apis/api/notification.d.ts:114


    silent

    silent: boolean;

    A boolean property representing whether the notification is silent.

    定义于

    apis/api/notification.d.ts:118


    sound

    sound: string;

    A string property representing the sound of the notification.

    定义于

    apis/api/notification.d.ts:122


    subtitle

    subtitle: string;

    A string property representing the subtitle of the notification.

    定义于

    apis/api/notification.d.ts:126


    timeoutType Windows

    timeoutType: 'default' | 'never';

    A string property representing the type of timeout duration for the notification. Can be 'default' or 'never'.

    If timeoutType is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.

    定义于

    apis/api/notification.d.ts:136


    title

    title: string;

    A string property representing the title of the notification.

    定义于

    apis/api/notification.d.ts:140


    toastXml Windows

    toastXml: string;

    A string property representing the custom Toast XML of the notification.

    定义于

    apis/api/notification.d.ts:146

    方法

    addListener()

    event: "show"

    addListener(event: "show", listener: () => void): this

    参数

    范围类型
    event"show"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:171

    event: "click"

    addListener(event: "click", listener: () => void): this

    参数

    范围类型
    event"click"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:180

    event: "close"

    addListener(event: "close", listener: () => void): this

    参数

    范围类型
    event"close"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:189

    event: "reply"

    addListener(event: "reply", listener: (event: Event, reply: string) => void): this

    参数

    范围类型
    event"reply"
    listener(event: Event, reply: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:200

    event: "action"

    addListener(event: "action", listener: (event: Event, index: number) => void): this

    参数

    范围类型
    event"action"
    listener(event: Event, index: number) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:217

    event: "failed"

    addListener(event: "failed", listener: (event: Event, error: string) => void): this

    参数

    范围类型
    event"failed"
    listener(event: Event, error: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:234


    close()

    close(): void

    Dismisses the notification.

    返回

    void

    定义于

    apis/api/notification.d.ts:158


    isSupported()

    static isSupported(): boolean

    Whether or not desktop notifications are supported on the current system.

    返回

    boolean

    定义于

    apis/api/notification.d.ts:163


    off()

    event: "show"

    off(event: "show", listener: () => void): this

    参数

    范围类型
    event"show"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:169

    event: "click"

    off(event: "click", listener: () => void): this

    参数

    范围类型
    event"click"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:178

    event: "close"

    off(event: "close", listener: () => void): this

    参数

    范围类型
    event"close"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:187

    event: "reply"

    off(event: "reply", listener: (event: Event, reply: string) => void): this

    参数

    范围类型
    event"reply"
    listener(event: Event, reply: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:198

    event: "action"

    off(event: "action", listener: (event: Event, index: number) => void): this

    参数

    范围类型
    event"action"
    listener(event: Event, index: number) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:215

    event: "failed"

    off(event: "failed", listener: (event: Event, error: string) => void): this

    参数

    范围类型
    event"failed"
    listener(event: Event, error: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:232


    on()

    event: "show"

    on(event: "show", listener: () => void): this

    Emitted when the notification is shown to the user.

    参数

    范围类型
    event"show"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:168

    event: "click"

    on(event: "click", listener: () => void): this

    Emitted when the notification is clicked by the user.

    参数

    范围类型
    event"click"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:177

    event: "close"

    on(event: "close", listener: () => void): this

    Emitted when the notification is closed by manual intervention from the user.

    参数

    范围类型
    event"close"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:186

    event: "reply" macOS

    on(event: "reply", listener: (event: Event, reply: string) => void): this

    Emitted when the user clicks the "Reply" button on a notification with hasReply: true.

    参数

    范围类型
    event"reply"
    listener(event: Event, reply: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:197

    event: "action" macOS

    on(event: "action", listener: (event: Event, index: number) => void): this

    Emitted when the user clicks one of the actions on a notification.

    参数

    范围类型
    event"action"
    listener(event: Event, index: number) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:214

    event: "failed" Windows

    on(event: "failed", listener: (event: Event, error: string) => void): this

    Emitted when an error is encountered while showing the notification.

    参数

    范围类型
    event"failed"
    listener(event: Event, error: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:231


    once()

    event: "show"

    once(event: "show", listener: () => void): this

    参数

    范围类型
    event"show"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:170

    event: "click"

    once(event: "click", listener: () => void): this

    参数

    范围类型
    event"click"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:179

    event: "close"

    once(event: "close", listener: () => void): this

    参数

    范围类型
    event"close"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:188

    event: "reply"

    once(event: "reply", listener: (event: Event, reply: string) => void): this

    参数

    范围类型
    event"reply"
    listener(event: Event, reply: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:199

    event: "action"

    once(event: "action", listener: (event: Event, index: number) => void): this

    参数

    范围类型
    event"action"
    listener(event: Event, index: number) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:216

    event: "failed"

    once(event: "failed", listener: (event: Event, error: string) => void): this

    参数

    范围类型
    event"failed"
    listener(event: Event, error: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:233


    removeListener()

    event: "show"

    removeListener(event: "show", listener: () => void): this

    参数

    范围类型
    event"show"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:172

    event: "click"

    removeListener(event: "click", listener: () => void): this

    参数

    范围类型
    event"click"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:181

    event: "close"

    removeListener(event: "close", listener: () => void): this

    参数

    范围类型
    event"close"
    listener() => void

    返回

    this

    定义于

    apis/api/notification.d.ts:190

    event: "reply"

    removeListener(event: "reply", listener: (event: Event, reply: string) => void): this

    参数

    范围类型
    event"reply"
    listener(event: Event, reply: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:204

    event: "action"

    removeListener(event: "action", listener: (event: Event, index: number) => void): this

    参数

    范围类型
    event"action"
    listener(event: Event, index: number) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:221

    event: "failed"

    removeListener(event: "failed", listener: (event: Event, error: string) => void): this

    参数

    范围类型
    event"failed"
    listener(event: Event, error: string) => void

    返回

    this

    定义于

    apis/api/notification.d.ts:238


    show()

    show(): void

    Immediately shows the notification to the user.

    返回

    void

    定义于

    apis/api/notification.d.ts:153

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。