2013-03-18 06:24:54 -07: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 10:28:14 -08:00
|
|
|
[Pref="dom.webnotifications.enabled",
|
|
|
|
Constructor(DOMString title, optional NotificationOptions options)]
|
2013-03-18 06:24:54 -07:00
|
|
|
interface Notification : EventTarget {
|
|
|
|
[GetterThrows]
|
|
|
|
static readonly attribute NotificationPermission permission;
|
|
|
|
|
|
|
|
[Throws]
|
|
|
|
static void requestPermission(optional NotificationPermissionCallback permissionCallback);
|
|
|
|
|
2013-10-02 18:27:53 -07:00
|
|
|
[Throws]
|
|
|
|
static Promise get(optional GetNotificationOptions filter);
|
|
|
|
|
2013-03-18 06:24:54 -07:00
|
|
|
attribute EventHandler onclick;
|
|
|
|
|
|
|
|
attribute EventHandler onshow;
|
|
|
|
|
|
|
|
attribute EventHandler onerror;
|
|
|
|
|
|
|
|
attribute EventHandler onclose;
|
|
|
|
|
2013-09-12 08:48:56 -07:00
|
|
|
[Pure]
|
2013-09-12 02:50:29 -07:00
|
|
|
readonly attribute DOMString title;
|
|
|
|
|
2013-09-12 08:48:56 -07:00
|
|
|
[Pure]
|
2013-09-12 02:50:29 -07:00
|
|
|
readonly attribute NotificationDirection dir;
|
|
|
|
|
2013-09-12 08:48:56 -07:00
|
|
|
[Pure]
|
2013-09-12 02:50:29 -07:00
|
|
|
readonly attribute DOMString? lang;
|
|
|
|
|
2013-09-12 08:48:56 -07:00
|
|
|
[Pure]
|
2013-09-12 02:50:29 -07:00
|
|
|
readonly attribute DOMString? body;
|
|
|
|
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMString? tag;
|
|
|
|
|
2013-09-12 08:48:56 -07:00
|
|
|
[Pure]
|
2013-09-12 02:50:29 -07:00
|
|
|
readonly attribute DOMString? icon;
|
|
|
|
|
2013-03-18 06:24:54 -07:00
|
|
|
void close();
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary NotificationOptions {
|
|
|
|
NotificationDirection dir = "auto";
|
|
|
|
DOMString lang = "";
|
|
|
|
DOMString body = "";
|
2013-10-02 18:27:53 -07:00
|
|
|
DOMString tag = "";
|
2013-10-07 11:41:13 -07:00
|
|
|
DOMString icon = "";
|
2013-10-02 18:27:53 -07:00
|
|
|
};
|
|
|
|
|
2013-10-02 18:27:53 -07:00
|
|
|
dictionary GetNotificationOptions {
|
|
|
|
DOMString tag;
|
|
|
|
};
|
|
|
|
|
2013-03-18 06:24:54 -07:00
|
|
|
enum NotificationPermission {
|
|
|
|
"default",
|
|
|
|
"denied",
|
|
|
|
"granted"
|
|
|
|
};
|
|
|
|
|
|
|
|
callback NotificationPermissionCallback = void (NotificationPermission permission);
|
|
|
|
|
|
|
|
enum NotificationDirection {
|
|
|
|
"auto",
|
|
|
|
"ltr",
|
|
|
|
"rtl"
|
|
|
|
};
|
|
|
|
|