|
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 * http://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 */ |
|
13 |
|
14 [Pref="dom.webnotifications.enabled", |
|
15 Constructor(DOMString title, optional NotificationOptions options)] |
|
16 interface Notification : EventTarget { |
|
17 [GetterThrows] |
|
18 static readonly attribute NotificationPermission permission; |
|
19 |
|
20 [Throws] |
|
21 static void requestPermission(optional NotificationPermissionCallback permissionCallback); |
|
22 |
|
23 [Throws] |
|
24 static Promise get(optional GetNotificationOptions filter); |
|
25 |
|
26 attribute EventHandler onclick; |
|
27 |
|
28 attribute EventHandler onshow; |
|
29 |
|
30 attribute EventHandler onerror; |
|
31 |
|
32 attribute EventHandler onclose; |
|
33 |
|
34 [Pure] |
|
35 readonly attribute DOMString title; |
|
36 |
|
37 [Pure] |
|
38 readonly attribute NotificationDirection dir; |
|
39 |
|
40 [Pure] |
|
41 readonly attribute DOMString? lang; |
|
42 |
|
43 [Pure] |
|
44 readonly attribute DOMString? body; |
|
45 |
|
46 [Constant] |
|
47 readonly attribute DOMString? tag; |
|
48 |
|
49 [Pure] |
|
50 readonly attribute DOMString? icon; |
|
51 |
|
52 void close(); |
|
53 }; |
|
54 |
|
55 dictionary NotificationOptions { |
|
56 NotificationDirection dir = "auto"; |
|
57 DOMString lang = ""; |
|
58 DOMString body = ""; |
|
59 DOMString tag = ""; |
|
60 DOMString icon = ""; |
|
61 }; |
|
62 |
|
63 dictionary GetNotificationOptions { |
|
64 DOMString tag; |
|
65 }; |
|
66 |
|
67 enum NotificationPermission { |
|
68 "default", |
|
69 "denied", |
|
70 "granted" |
|
71 }; |
|
72 |
|
73 callback NotificationPermissionCallback = void (NotificationPermission permission); |
|
74 |
|
75 enum NotificationDirection { |
|
76 "auto", |
|
77 "ltr", |
|
78 "rtl" |
|
79 }; |
|
80 |