Debian Codegraph @

externs/webkit_notifications.js

raw symbols SCIP
1 /*
2 * Copyright 2010 Closure Compiler Authors
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 /**
17 * @fileoverview Definitions for W3C's Notifications specification.
18 * @externs
19 */
20
21 /**
22 * @param {string} title
23 * @param {Object=} opt_options
24 * @constructor
25 * @implements {EventTarget}
26 * @see http://notifications.spec.whatwg.org/#notification
27 */
28 function Notification(title, opt_options) {}
29
30 /**
31 * @type {string}
32 */
33 Notification.permission;
34
35 /**
36 * @param {NotificationPermissionCallback=} opt_callback
37 */
38 Notification.requestPermission = function(opt_callback) {};
39
40 /** @override */
41 Notification.prototype.addEventListener =
42 function(type, listener, useCapture) {};
43
44 /** @override */
45 Notification.prototype.removeEventListener =
46 function(type, listener, useCapture) {};
47
48 /** @override */
49 Notification.prototype.dispatchEvent = function(evt) {};
50
51 /**
52 * The ID used by clients to uniquely identify notifications to eliminate
53 * duplicate notifications.
54 * @type {string}
55 * @deprecated Use NotificationOptions.tag instead.
56 */
57 Notification.prototype.replaceId;
58
59 /**
60 * The string used by clients to specify the directionality (rtl/ltr) of the
61 * notification.
62 * @type {string}
63 * @deprecated Use NotificationOptions.titleDir and bodyDir instead.
64 */
65 Notification.prototype.dir;
66
67 /**
68 * Displays the notification.
69 */
70 Notification.prototype.show = function() {};
71
72 /**
73 * Prevents the notification from being displayed, or closes it if it is already
74 * displayed.
75 */
76 Notification.prototype.cancel = function() {};
77
78 /**
79 * Prevents the notification from being displayed, or closes it if it is already
80 * displayed.
81 */
82 Notification.prototype.close = function() {};
83
84 /**
85 * An event handler called when notification is closed.
86 * @type {?function(Event)}
87 */
88 Notification.prototype.onclose;
89
90 /**
91 * An event handler called if the notification could not be displayed due to
92 * an error (i.e. resource could not be loaded).
93 * @type {?function(Event)}
94 */
95 Notification.prototype.onerror;
96
97 /**
98 * An event handler called when the notification has become visible.
99 * @type {?function(Event)}
100 * @deprecated Use onshow instead.
101 */
102 Notification.prototype.ondisplay;
103
104 /**
105 * An event handler called when the notification has become visible.
106 * @type {?function(Event)}
107 */
108 Notification.prototype.onshow;
109
110 /**
111 * An event handler called when the notification has been clicked on.
112 * @type {?function(Event)}
113 */
114 Notification.prototype.onclick;
115
116 /**
117 * @typedef {function(string)}
118 * @see http://notifications.spec.whatwg.org/#notificationpermissioncallback
119 */
120 var NotificationPermissionCallback;
121
122 /**
123 * @constructor
124 * @see http://dev.w3.org/2006/webapi/WebNotifications/publish/#dialog-if
125 * @deprecated Use Notification instead.
126 */
127 function NotificationCenter() {}
128
129 /**
130 * Creates a text+icon notification and displays it to the user.
131 * @param {string} iconUrl
132 * @param {string} title
133 * @param {string} body
134 * @return {Notification}
135 */
136 NotificationCenter.prototype.createNotification =
137 function(iconUrl, title, body) {};
138
139 /**
140 * Creates an HTML notification and displays it to the user.
141 * @param {string} url
142 * @return {Notification}
143 */
144 NotificationCenter.prototype.createHTMLNotification = function(url) {};
145
146 /**
147 * Checks if the user has permission to display notifications.
148 * @return {number}
149 */
150 NotificationCenter.prototype.checkPermission = function() {};
151
152 /**
153 * Requests permission from the user to display notifications.
154 * @param {Function=} opt_callback
155 * @return {void}
156 */
157 NotificationCenter.prototype.requestPermission = function(opt_callback) {};
158
159 /**
160 * WebKit browsers expose the NotificationCenter API through
161 * window.webkitNotifications.
162 * @type {NotificationCenter}
163 */
164 Window.prototype.webkitNotifications;
165