Chartbreaker
    Preparing search index...

    Interface Notification

    The Notification interface of the Notifications API is used to configure and display desktop notifications to the user.

    MDN Reference

    interface Notification {
        body: string;
        data: any;
        dir: NotificationDirection;
        icon: string;
        lang: string;
        onclick: ((this: Notification, ev: Event) => any) | null;
        onclose: ((this: Notification, ev: Event) => any) | null;
        onerror: ((this: Notification, ev: Event) => any) | null;
        onshow: ((this: Notification, ev: Event) => any) | null;
        requireInteraction: boolean;
        silent: boolean | null;
        tag: string;
        title: string;
        addEventListener<K extends keyof NotificationEventMap>(
            type: K,
            listener: (this: Notification, ev: NotificationEventMap[K]) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        close(): void;
        dispatchEvent(event: Event): boolean;
        removeEventListener<K extends keyof NotificationEventMap>(
            type: K,
            listener: (this: Notification, ev: NotificationEventMap[K]) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        removeEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    body: string

    The body read-only property of the Notification interface indicates the body string of the notification, as specified in the body option of the Notification() constructor.

    MDN Reference

    data: any

    The data read-only property of the Notification interface returns a structured clone of the notification's data, as specified in the data option of the Notification() constructor.

    MDN Reference

    The dir read-only property of the Notification interface indicates the text direction of the notification, as specified in the dir option of the Notification() constructor.

    MDN Reference

    icon: string

    The icon read-only property of the Notification interface contains the URL of an icon to be displayed as part of the notification, as specified in the icon option of the Notification() constructor.

    MDN Reference

    lang: string

    The lang read-only property of the Notification interface indicates the language used in the notification, as specified in the lang option of the Notification() constructor.

    MDN Reference

    onclick: ((this: Notification, ev: Event) => any) | null
    onclose: ((this: Notification, ev: Event) => any) | null
    onerror: ((this: Notification, ev: Event) => any) | null
    onshow: ((this: Notification, ev: Event) => any) | null
    requireInteraction: boolean

    The requireInteraction read-only property of the Notification interface returns a boolean value indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.

    MDN Reference

    silent: boolean | null

    The silent read-only property of the Notification interface specifies whether the notification should be silent, i.e., no sounds or vibrations should be issued regardless of the device settings. This is controlled via the silent option of the Notification() constructor.

    MDN Reference

    tag: string

    The tag read-only property of the Notification interface signifies an identifying tag for the notification, as specified in the tag option of the Notification() constructor.

    MDN Reference

    title: string

    The title read-only property of the Notification interface indicates the title of the notification, as specified in the title parameter of the Notification() constructor.

    MDN Reference

    Methods

    • The close() method of the Notification interface is used to close/remove a previously displayed notification.

      MDN Reference

      Returns void

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Type Parameters

      Parameters

      Returns void

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Parameters

      Returns void