michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * http://notifications.spec.whatwg.org/ michael@0: * michael@0: * Copyright: michael@0: * To the extent possible under law, the editors have waived all copyright and michael@0: * related or neighboring rights to this work. michael@0: */ michael@0: michael@0: [Pref="dom.webnotifications.enabled", michael@0: Constructor(DOMString title, optional NotificationOptions options)] michael@0: interface Notification : EventTarget { michael@0: [GetterThrows] michael@0: static readonly attribute NotificationPermission permission; michael@0: michael@0: [Throws] michael@0: static void requestPermission(optional NotificationPermissionCallback permissionCallback); michael@0: michael@0: [Throws] michael@0: static Promise get(optional GetNotificationOptions filter); michael@0: michael@0: attribute EventHandler onclick; michael@0: michael@0: attribute EventHandler onshow; michael@0: michael@0: attribute EventHandler onerror; michael@0: michael@0: attribute EventHandler onclose; michael@0: michael@0: [Pure] michael@0: readonly attribute DOMString title; michael@0: michael@0: [Pure] michael@0: readonly attribute NotificationDirection dir; michael@0: michael@0: [Pure] michael@0: readonly attribute DOMString? lang; michael@0: michael@0: [Pure] michael@0: readonly attribute DOMString? body; michael@0: michael@0: [Constant] michael@0: readonly attribute DOMString? tag; michael@0: michael@0: [Pure] michael@0: readonly attribute DOMString? icon; michael@0: michael@0: void close(); michael@0: }; michael@0: michael@0: dictionary NotificationOptions { michael@0: NotificationDirection dir = "auto"; michael@0: DOMString lang = ""; michael@0: DOMString body = ""; michael@0: DOMString tag = ""; michael@0: DOMString icon = ""; michael@0: }; michael@0: michael@0: dictionary GetNotificationOptions { michael@0: DOMString tag; michael@0: }; michael@0: michael@0: enum NotificationPermission { michael@0: "default", michael@0: "denied", michael@0: "granted" michael@0: }; michael@0: michael@0: callback NotificationPermissionCallback = void (NotificationPermission permission); michael@0: michael@0: enum NotificationDirection { michael@0: "auto", michael@0: "ltr", michael@0: "rtl" michael@0: }; michael@0: