tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Notification.webidl (3378B)


      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 * https://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 [Exposed=(Window,Worker),
     15 Func="mozilla::dom::Notification::PrefEnabled"]
     16 interface Notification : EventTarget {
     17  [Throws]
     18  constructor(DOMString title, optional NotificationOptions options = {});
     19 
     20  [GetterThrows]
     21  static readonly attribute NotificationPermission permission;
     22 
     23  [NewObject, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"]
     24  static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback);
     25 
     26  [Pref="dom.webnotifications.actions.enabled"]
     27  static readonly attribute unsigned long maxActions;
     28 
     29  attribute EventHandler onclick;
     30 
     31  attribute EventHandler onshow;
     32 
     33  attribute EventHandler onerror;
     34 
     35  attribute EventHandler onclose;
     36 
     37  [Pure]
     38  readonly attribute DOMString title;
     39 
     40  [Pure]
     41  readonly attribute NotificationDirection dir;
     42 
     43  [Pure]
     44  readonly attribute DOMString lang;
     45 
     46  [Pure]
     47  readonly attribute DOMString body;
     48 
     49  [Constant]
     50  readonly attribute DOMString tag;
     51 
     52  [Pure]
     53  readonly attribute UTF8String icon;
     54 
     55  [Constant, Pref="dom.webnotifications.requireinteraction.enabled"]
     56  readonly attribute boolean requireInteraction;
     57 
     58  [Constant, Pref="dom.webnotifications.silent.enabled"]
     59  readonly attribute boolean silent;
     60 
     61  [Cached, Frozen, Pure, Pref="dom.webnotifications.vibrate.enabled"]
     62  readonly attribute sequence<unsigned long> vibrate;
     63 
     64  [Constant]
     65  readonly attribute any data;
     66 
     67  // Bug 1236777: FrozenArray is not supported
     68  // [SameObject] readonly attribute FrozenArray<NotificationAction> actions;
     69  [Frozen, Cached, Pure, Pref="dom.webnotifications.actions.enabled"]
     70  readonly attribute sequence<NotificationAction> actions;
     71 
     72  undefined close();
     73 };
     74 
     75 typedef (unsigned long or sequence<unsigned long>) VibratePattern;
     76 
     77 dictionary NotificationOptions {
     78  NotificationDirection dir = "auto";
     79  DOMString lang = "";
     80  DOMString body = "";
     81  // [UseCounter], bug 1976515
     82  UTF8String navigate;
     83  DOMString tag = "";
     84  // [UseCounter], bug 1976515
     85  UTF8String image;
     86  UTF8String icon = "";
     87  // [UseCounter], bug 1976515
     88  UTF8String badge;
     89  // [UseCounter], bug 1976515
     90  VibratePattern vibrate;
     91  // [UseCounter], bug 1976515
     92  EpochTimeStamp timestamp;
     93  // [UseCounter], bug 1976515
     94  boolean renotify = false;
     95  boolean silent = false;
     96  // [UseCounter], bug 1976515
     97  boolean requireInteraction = false;
     98  any data = null;
     99  // [UseCounter], bug 1976515
    100  [Pref="dom.webnotifications.actions.enabled"]
    101  sequence<NotificationAction> actions = [];
    102 };
    103 
    104 dictionary GetNotificationOptions {
    105  DOMString tag = "";
    106 };
    107 
    108 enum NotificationPermission {
    109  "default",
    110  "denied",
    111  "granted"
    112 };
    113 
    114 dictionary NotificationAction {
    115  required DOMString action;
    116  required DOMString title;
    117 };
    118 
    119 callback NotificationPermissionCallback = undefined (NotificationPermission permission);
    120 
    121 enum NotificationDirection {
    122  "auto",
    123  "ltr",
    124  "rtl"
    125 };