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