Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | * |
michael@0 | 6 | * The origin of this IDL file is |
michael@0 | 7 | * http://notifications.spec.whatwg.org/ |
michael@0 | 8 | * |
michael@0 | 9 | * Copyright: |
michael@0 | 10 | * To the extent possible under law, the editors have waived all copyright and |
michael@0 | 11 | * related or neighboring rights to this work. |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | [Pref="dom.webnotifications.enabled", |
michael@0 | 15 | Constructor(DOMString title, optional NotificationOptions options)] |
michael@0 | 16 | interface Notification : EventTarget { |
michael@0 | 17 | [GetterThrows] |
michael@0 | 18 | static readonly attribute NotificationPermission permission; |
michael@0 | 19 | |
michael@0 | 20 | [Throws] |
michael@0 | 21 | static void requestPermission(optional NotificationPermissionCallback permissionCallback); |
michael@0 | 22 | |
michael@0 | 23 | [Throws] |
michael@0 | 24 | static Promise get(optional GetNotificationOptions filter); |
michael@0 | 25 | |
michael@0 | 26 | attribute EventHandler onclick; |
michael@0 | 27 | |
michael@0 | 28 | attribute EventHandler onshow; |
michael@0 | 29 | |
michael@0 | 30 | attribute EventHandler onerror; |
michael@0 | 31 | |
michael@0 | 32 | attribute EventHandler onclose; |
michael@0 | 33 | |
michael@0 | 34 | [Pure] |
michael@0 | 35 | readonly attribute DOMString title; |
michael@0 | 36 | |
michael@0 | 37 | [Pure] |
michael@0 | 38 | readonly attribute NotificationDirection dir; |
michael@0 | 39 | |
michael@0 | 40 | [Pure] |
michael@0 | 41 | readonly attribute DOMString? lang; |
michael@0 | 42 | |
michael@0 | 43 | [Pure] |
michael@0 | 44 | readonly attribute DOMString? body; |
michael@0 | 45 | |
michael@0 | 46 | [Constant] |
michael@0 | 47 | readonly attribute DOMString? tag; |
michael@0 | 48 | |
michael@0 | 49 | [Pure] |
michael@0 | 50 | readonly attribute DOMString? icon; |
michael@0 | 51 | |
michael@0 | 52 | void close(); |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | dictionary NotificationOptions { |
michael@0 | 56 | NotificationDirection dir = "auto"; |
michael@0 | 57 | DOMString lang = ""; |
michael@0 | 58 | DOMString body = ""; |
michael@0 | 59 | DOMString tag = ""; |
michael@0 | 60 | DOMString icon = ""; |
michael@0 | 61 | }; |
michael@0 | 62 | |
michael@0 | 63 | dictionary GetNotificationOptions { |
michael@0 | 64 | DOMString tag; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | enum NotificationPermission { |
michael@0 | 68 | "default", |
michael@0 | 69 | "denied", |
michael@0 | 70 | "granted" |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | callback NotificationPermissionCallback = void (NotificationPermission permission); |
michael@0 | 74 | |
michael@0 | 75 | enum NotificationDirection { |
michael@0 | 76 | "auto", |
michael@0 | 77 | "ltr", |
michael@0 | 78 | "rtl" |
michael@0 | 79 | }; |
michael@0 | 80 |