1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://notifications.spec.whatwg.org/
10 * To the extent possible under law, the editors have waived all copyright and
11 * related or neighboring rights to this work.
14 [Exposed=(Window,Worker),
15 Func="mozilla::dom::Notification::PrefEnabled"]
16 interface Notification : EventTarget {
18 constructor(DOMString title, optional NotificationOptions options = {});
21 static readonly attribute NotificationPermission permission;
23 [NewObject, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"]
24 static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback);
26 attribute EventHandler onclick;
28 attribute EventHandler onshow;
30 attribute EventHandler onerror;
32 attribute EventHandler onclose;
35 readonly attribute DOMString title;
38 readonly attribute NotificationDirection dir;
41 readonly attribute DOMString? lang;
44 readonly attribute DOMString? body;
47 readonly attribute DOMString? tag;
50 readonly attribute DOMString? icon;
52 [Constant, Pref="dom.webnotifications.requireinteraction.enabled"]
53 readonly attribute boolean requireInteraction;
55 [Constant, Pref="dom.webnotifications.silent.enabled"]
56 readonly attribute boolean silent;
58 [Cached, Frozen, Pure, Pref="dom.webnotifications.vibrate.enabled"]
59 readonly attribute sequence<unsigned long> vibrate;
62 readonly attribute any data;
67 typedef (unsigned long or sequence<unsigned long>) VibratePattern;
69 dictionary NotificationOptions {
70 NotificationDirection dir = "auto";
75 boolean requireInteraction = false;
76 boolean silent = false;
77 VibratePattern vibrate;
79 NotificationBehavior mozbehavior = {};
82 dictionary GetNotificationOptions {
87 dictionary NotificationBehavior {
88 boolean noscreen = false;
89 boolean noclear = false;
90 boolean showOnlyOnce = false;
91 DOMString soundFile = "";
92 sequence<unsigned long> vibrationPattern;
95 enum NotificationPermission {
101 callback NotificationPermissionCallback = undefined (NotificationPermission permission);
103 enum NotificationDirection {