Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / Notification.webidl
blob8c96a81713f6132d0dc29fbf050ffec3e4db4914
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/.
5  *
6  * The origin of this IDL file is
7  * https://notifications.spec.whatwg.org/
8  *
9  * Copyright:
10  * To the extent possible under law, the editors have waived all copyright and
11  * related or neighboring rights to this work.
12  */
14 [Exposed=(Window,Worker),
15  Func="mozilla::dom::Notification::PrefEnabled"]
16 interface Notification : EventTarget {
17   [Throws]
18   constructor(DOMString title, optional NotificationOptions options = {});
20   [GetterThrows]
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;
34   [Pure]
35   readonly attribute DOMString title;
37   [Pure]
38   readonly attribute NotificationDirection dir;
40   [Pure]
41   readonly attribute DOMString? lang;
43   [Pure]
44   readonly attribute DOMString? body;
46   [Constant]
47   readonly attribute DOMString? tag;
49   [Pure]
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;
61   [Constant]
62   readonly attribute any data;
64   undefined close();
67 typedef (unsigned long or sequence<unsigned long>) VibratePattern;
69 dictionary NotificationOptions {
70   NotificationDirection dir = "auto";
71   DOMString lang = "";
72   DOMString body = "";
73   DOMString tag = "";
74   DOMString icon = "";
75   boolean requireInteraction = false;
76   boolean silent = false;
77   VibratePattern vibrate;
78   any data = null;
79   NotificationBehavior mozbehavior = {};
82 dictionary GetNotificationOptions {
83   DOMString tag = "";
86 [GenerateToJSON]
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 {
96   "default",
97   "denied",
98   "granted"
101 callback NotificationPermissionCallback = undefined (NotificationPermission permission);
103 enum NotificationDirection {
104   "auto",
105   "ltr",
106   "rtl"