2 * Copyright 2010 The Closure Compiler Authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @fileoverview Definitions for W3C's Notifications specification.
22 * @typedef {{dir: (string|undefined), lang: (string|undefined),
23 * body: (string|undefined), tag: (string|undefined),
24 * icon: (string|undefined)}}
25 * @see http://notifications.spec.whatwg.org/#notificationoptions
27 var NotificationOptions;
30 var NotificationOptionsInterface_;
31 /** @type {string} */ NotificationOptionsInterface_.prototype.dir;
32 /** @type {string} */ NotificationOptionsInterface_.prototype.lang;
33 /** @type {string} */ NotificationOptionsInterface_.prototype.body;
34 /** @type {string} */ NotificationOptionsInterface_.prototype.tag;
35 /** @type {string} */ NotificationOptionsInterface_.prototype.icon;
38 * @param {string} title
39 * @param {NotificationOptions=} opt_options
41 * @implements {EventTarget}
42 * @see http://notifications.spec.whatwg.org/#notification
44 function Notification(title, opt_options) {}
49 Notification.permission;
52 * @param {NotificationPermissionCallback=} opt_callback
54 Notification.requestPermission = function(opt_callback) {};
57 * @param {boolean=} opt_useCapture
60 Notification.prototype.addEventListener =
61 function(type, listener, opt_useCapture) {};
64 * @param {boolean=} opt_useCapture
67 Notification.prototype.removeEventListener =
68 function(type, listener, opt_useCapture) {};
71 Notification.prototype.dispatchEvent = function(evt) {};
74 * The ID used by clients to uniquely identify notifications to eliminate
75 * duplicate notifications.
77 * @deprecated Use NotificationOptions.tag instead.
79 Notification.prototype.replaceId;
82 * The string used by clients to specify the directionality (rtl/ltr) of the
85 * @deprecated Use NotificationOptions.titleDir and bodyDir instead.
87 Notification.prototype.dir;
90 * Displays the notification.
92 Notification.prototype.show = function() {};
95 * Prevents the notification from being displayed, or closes it if it is already
98 Notification.prototype.cancel = function() {};
101 * Prevents the notification from being displayed, or closes it if it is already
104 Notification.prototype.close = function() {};
107 * An event handler called when notification is closed.
108 * @type {?function(Event)}
110 Notification.prototype.onclose;
113 * An event handler called if the notification could not be displayed due to
114 * an error (i.e. resource could not be loaded).
115 * @type {?function(Event)}
117 Notification.prototype.onerror;
120 * An event handler called when the notification has become visible.
121 * @type {?function(Event)}
122 * @deprecated Use onshow instead.
124 Notification.prototype.ondisplay;
127 * An event handler called when the notification has become visible.
128 * @type {?function(Event)}
130 Notification.prototype.onshow;
133 * An event handler called when the notification has been clicked on.
134 * @type {?function(Event)}
136 Notification.prototype.onclick;
141 window.Notification = Notification;
146 window.Notification.permission;
149 * @param {NotificationPermissionCallback=} opt_callback
151 window.Notification.requestPermission = function(opt_callback) {};
154 * @typedef {function(string)}
155 * @see http://notifications.spec.whatwg.org/#notificationpermissioncallback
157 var NotificationPermissionCallback;
161 * @see http://dev.w3.org/2006/webapi/WebNotifications/publish/#dialog-if
162 * @deprecated Use Notification instead.
164 function NotificationCenter() {}
167 * Creates a text+icon notification and displays it to the user.
168 * @param {string} iconUrl
169 * @param {string} title
170 * @param {string} body
171 * @return {Notification}
173 NotificationCenter.prototype.createNotification =
174 function(iconUrl, title, body) {};
177 * Creates an HTML notification and displays it to the user.
178 * @param {string} url
179 * @return {Notification}
181 NotificationCenter.prototype.createHTMLNotification = function(url) {};
184 * Checks if the user has permission to display notifications.
187 NotificationCenter.prototype.checkPermission = function() {};
190 * Requests permission from the user to display notifications.
191 * @param {Function=} opt_callback
194 NotificationCenter.prototype.requestPermission = function(opt_callback) {};
197 * WebKit browsers expose the NotificationCenter API through
198 * window.webkitNotifications.
199 * @type {NotificationCenter}
201 Window.prototype.webkitNotifications;