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
|
2017-01-25 00:11:30 +03:00
|
|
|
* https://notifications.spec.whatwg.org/
|
2013-03-18 17:24:54 +04:00
|
|
|
*
|
|
|
|
* Copyright:
|
|
|
|
* To the extent possible under law, the editors have waived all copyright and
|
|
|
|
* related or neighboring rights to this work.
|
|
|
|
*/
|
|
|
|
|
2015-06-26 04:53:02 +03:00
|
|
|
[Constructor(DOMString title, optional NotificationOptions options),
|
|
|
|
Exposed=(Window,Worker),
|
|
|
|
Func="mozilla::dom::Notification::PrefEnabled",
|
2014-12-21 20:02:33 +03:00
|
|
|
UnsafeInPrerendering]
|
2013-03-18 17:24:54 +04:00
|
|
|
interface Notification : EventTarget {
|
|
|
|
[GetterThrows]
|
|
|
|
static readonly attribute NotificationPermission permission;
|
|
|
|
|
2015-06-26 04:53:02 +03:00
|
|
|
[Throws, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"]
|
2016-01-21 01:23:04 +03:00
|
|
|
static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback);
|
2013-03-18 17:24:54 +04:00
|
|
|
|
2015-06-26 04:53:02 +03:00
|
|
|
[Throws, Func="mozilla::dom::Notification::IsGetEnabled"]
|
2014-08-01 07:50:30 +04:00
|
|
|
static Promise<sequence<Notification>> get(optional GetNotificationOptions filter);
|
2013-10-03 05:27:53 +04:00
|
|
|
|
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;
|
|
|
|
|
2016-10-13 02:43:27 +03:00
|
|
|
[Constant, Func="mozilla::dom::Notification::RequireInteractionEnabled"]
|
2016-10-13 03:27:40 +03:00
|
|
|
readonly attribute boolean requireInteraction;
|
|
|
|
|
2014-08-21 04:56:12 +04:00
|
|
|
[Constant]
|
|
|
|
readonly attribute any data;
|
|
|
|
|
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 = "";
|
2016-10-13 03:27:40 +03:00
|
|
|
boolean requireInteraction = false;
|
2014-08-21 04:56:12 +04:00
|
|
|
any data = null;
|
2014-09-17 01:12:00 +04:00
|
|
|
NotificationBehavior mozbehavior = null;
|
2013-10-03 05:27:53 +04:00
|
|
|
};
|
|
|
|
|
2013-10-03 05:27:53 +04:00
|
|
|
dictionary GetNotificationOptions {
|
2015-06-26 04:50:24 +03:00
|
|
|
DOMString tag = "";
|
2013-10-03 05:27:53 +04:00
|
|
|
};
|
|
|
|
|
2014-09-17 01:12:00 +04:00
|
|
|
dictionary NotificationBehavior {
|
|
|
|
boolean noscreen = false;
|
|
|
|
boolean noclear = false;
|
2014-11-25 16:26:00 +03:00
|
|
|
boolean showOnlyOnce = false;
|
2014-09-17 01:12:00 +04:00
|
|
|
DOMString soundFile = "";
|
|
|
|
sequence<unsigned long> vibrationPattern;
|
|
|
|
};
|
|
|
|
|
2013-03-18 17:24:54 +04:00
|
|
|
enum NotificationPermission {
|
|
|
|
"default",
|
|
|
|
"denied",
|
|
|
|
"granted"
|
|
|
|
};
|
|
|
|
|
|
|
|
callback NotificationPermissionCallback = void (NotificationPermission permission);
|
|
|
|
|
|
|
|
enum NotificationDirection {
|
|
|
|
"auto",
|
|
|
|
"ltr",
|
|
|
|
"rtl"
|
|
|
|
};
|