dom/webidl/Notification.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/Notification.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 + *
     1.9 + * The origin of this IDL file is
    1.10 + * http://notifications.spec.whatwg.org/
    1.11 + *
    1.12 + * Copyright:
    1.13 + * To the extent possible under law, the editors have waived all copyright and
    1.14 + * related or neighboring rights to this work.
    1.15 + */
    1.16 +
    1.17 +[Pref="dom.webnotifications.enabled",
    1.18 + Constructor(DOMString title, optional NotificationOptions options)]
    1.19 +interface Notification : EventTarget {
    1.20 +  [GetterThrows]
    1.21 +  static readonly attribute NotificationPermission permission;
    1.22 +
    1.23 +  [Throws]
    1.24 +  static void requestPermission(optional NotificationPermissionCallback permissionCallback);
    1.25 +
    1.26 +  [Throws]
    1.27 +  static Promise get(optional GetNotificationOptions filter);
    1.28 +
    1.29 +  attribute EventHandler onclick;
    1.30 +
    1.31 +  attribute EventHandler onshow;
    1.32 +
    1.33 +  attribute EventHandler onerror;
    1.34 +
    1.35 +  attribute EventHandler onclose;
    1.36 +
    1.37 +  [Pure]
    1.38 +  readonly attribute DOMString title;
    1.39 +
    1.40 +  [Pure]
    1.41 +  readonly attribute NotificationDirection dir;
    1.42 +
    1.43 +  [Pure]
    1.44 +  readonly attribute DOMString? lang;
    1.45 +
    1.46 +  [Pure]
    1.47 +  readonly attribute DOMString? body;
    1.48 +
    1.49 +  [Constant]
    1.50 +  readonly attribute DOMString? tag;
    1.51 +
    1.52 +  [Pure]
    1.53 +  readonly attribute DOMString? icon;
    1.54 +
    1.55 +  void close();
    1.56 +};
    1.57 +
    1.58 +dictionary NotificationOptions {
    1.59 +  NotificationDirection dir = "auto";
    1.60 +  DOMString lang = "";
    1.61 +  DOMString body = "";
    1.62 +  DOMString tag = "";
    1.63 +  DOMString icon = "";
    1.64 +};
    1.65 +
    1.66 +dictionary GetNotificationOptions {
    1.67 +  DOMString tag;
    1.68 +};
    1.69 +
    1.70 +enum NotificationPermission {
    1.71 +  "default",
    1.72 +  "denied",
    1.73 +  "granted"
    1.74 +};
    1.75 +
    1.76 +callback NotificationPermissionCallback = void (NotificationPermission permission);
    1.77 +
    1.78 +enum NotificationDirection {
    1.79 +  "auto",
    1.80 +  "ltr",
    1.81 +  "rtl"
    1.82 +};
    1.83 +

mercurial