Debian Codegraph @

contrib/externs/api/gadgets/iframes.js

raw symbols SCIP
1 /*
2 * Copyright 2008 Google Inc.
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 /**
18 * @fileoverview Externs file for the Iframes library.
19 * @externs
20 */
21
22
23 /**
24 * The namespace for most of the APIs.
25 * @type {!iframes.Iframes}
26 * @suppress {checkTypes} In some crazy locations, this is being used as a
27 * source file. It needs to be assigned to some object so that the
28 * iframes.Iframes definition doesn't fail.
29 */
30 var iframes = /** @type {!iframes.Iframes} */ ({});
31
32
33 /**
34 * The namespace for most of the APIs.
35 *
36 * This has "|undefined" so that JSCompiler won't optimize out existence checks
37 * for win.iframes.
38 *
39 * @type {!iframes.Iframes|undefined}
40 */
41 Window.prototype.iframes;
42
43
44 /**
45 * The type for the Iframes API.
46 * @constructor
47 */
48 iframes.Iframes = function() {};
49
50
51 /**
52 * Gets the handler for a given style.
53 *
54 * @param {string} style
55 * @return {Object|Function} The handler for the given style.
56 */
57 iframes.Iframes.prototype.getHandler = function(style) {};
58
59 /**
60 * Sets the handler for a given style.
61 *
62 * @param {string} style
63 * @param {Object|Function} handler The handler for a given style.
64 * If the style handle is a function, the object returned by this
65 * function providing the iframe as the parameter is used as the
66 * actual style handler for every iframe opened in the style it
67 * handles.
68 * The follow methods of the handler are significant (note
69 * that the iframe parameter only presents when the original
70 * style handler is not a function):
71 * open(iframe): called to open the iframe.
72 * call iframe.openInto(el) to perform the open action.
73 * onready(iframe): called when the iframe is ready.
74 * close(iframe): called to close the iframe.
75 */
76 iframes.Iframes.prototype.setHandler = function(style, handler) {};
77
78 /**
79 * Gets a deferred-loaded style handler.
80 * @param {string} style The name of the style.
81 * @return {?function(function())} The deferred loader, if any.
82 */
83 iframes.Iframes.prototype.getDeferredHandler = function(style) {};
84
85 /**
86 * Sets a deferred-loaded style handler.
87 * @param {string} style The name of the style.
88 * @param {function(function())} loader The method to load the new style
89 * handler, which should call iframes.setHandler for that style.
90 * It then needs to call the callback method passed in.
91 */
92 iframes.Iframes.prototype.setDeferredHandler = function(style, loader) {};
93
94 /**
95 * This is an internal class to represent an iframe, not the DOM element.
96 * @constructor
97 */
98 iframes.Iframe = function() {};
99
100 /**
101 * Methods used to pass to the iframe being opened.
102 * @return {Object}
103 */
104 iframes.Iframe.prototype.getMethods = function() {};
105
106 /**
107 * Parameters used for opening the widget.
108 * @return {Object}
109 */
110 iframes.Iframe.prototype.getOpenParams = function() {};
111
112 /**
113 * Parameters used to pass to the iframe being opened.
114 * @return {Object}
115 */
116 iframes.Iframe.prototype.getParams = function() {};
117
118 /**
119 * @type {Element}
120 * @deprecated
121 */
122 iframes.Iframe.prototype.containerDiv;
123
124 /**
125 * DOM reference to element containing iframe element.
126 *
127 * @return {Element}
128 */
129 iframes.Iframe.prototype.getSiteEl = function() {};
130
131 /**
132 * @param {Element} element DOM element containing the iframe element.
133 */
134 iframes.Iframe.prototype.setSiteEl = function(element) {};
135
136 /**
137 * DOM reference to the iframe element containing the widget.
138 *
139 * @return {Element}
140 */
141 iframes.Iframe.prototype.getIframeEl = function() {};
142
143 /**
144 * generated ID that will be set on the widget when it is opened
145 *
146 * @return {string}
147 */
148 iframes.Iframe.prototype.getId = function() {};
149
150 /**
151 * Iframe class instance that opened our Iframe instance.
152 *
153 * @return {iframes.Iframe}
154 */
155 iframes.Iframe.prototype.getOpenerIframe = function() {};
156
157 /**
158 * Exposes the method so it can be called from iframe object.
159 * This is supposed be called by the style handler while handling 'open'
160 * before calling 'openInto'.
161 *
162 * @param {string} name Name of the method as being called.
163 * @param {Function} method The method to be exposed.
164 */
165 iframes.Iframe.prototype.exposeMethod = function(name, method) {};
166
167 /**
168 * @param {string|Element} el The DOM element or its ID to open the iframe
169 * into.
170 * @param {Object=} opt_iframeAttributes Key-value pairs of iframe attributes.
171 * @return {iframes.Iframe} This iframe object (not the DOM element).
172 **/
173 iframes.Iframe.prototype.openInto = function(el, opt_iframeAttributes) {};
174
175 /**
176 * Close the iframe.
177 *
178 * @param {*=} opt_params Data to pass to the callback.
179 * @return {*} The result from the callback function.
180 */
181 iframes.Iframe.prototype.close = function(opt_params) {};
182
183 /**
184 * Removes the iframe element from the DOM tree.
185 */
186 iframes.Iframe.prototype.remove = function() {};
187
188 /**
189 * Adds a callback method for a given type of event.
190 *
191 * @param {string} type The event type: e.g. 'ready' or 'close'.
192 * @param {Function} callback The callback method.
193 */
194 iframes.Iframe.prototype.addCallback = function(type, callback) {};
195
196 /**
197 * Removes a callback method for a given type of event.
198 *
199 * @param {string} type The event type used in 'addCallback'.
200 * @param {Function} callback The callback method used in 'addCallback'.
201 */
202 iframes.Iframe.prototype.removeCallback = function(type, callback) {};
203
204 /**
205 * Allows a global function for all iframes.
206 *
207 * @param {string} name The name of the method for the iframes.
208 * @param {?function(...[*]) : *=} opt_func A optional function, by default
209 * window[name].
210 */
211 iframes.Iframes.prototype.allow = function(name, opt_func) {};
212
213 /**
214 * Opens an iframe.
215 *
216 * WARNING: This API takes ownership of all object parameters and will
217 * modify them. Make a copy if you want to reuse them.
218 *
219 * @param {string} url The URL of the iframe to be opened.
220 * @param {Object} openParams The parameters for opening the iframe.
221 * style: specify which handler is used.
222 * For the default handler, the follow attributes are used:
223 * element: the element which the iframe would be opened into.
224 * @param {Object} params The data to be passed to the iframe.
225 * All properties should be string.
226 * @param {Object|function(...[*]) : *=} opt_methods: Functions to passed to
227 * the iframe. All properties should be functions. If no 'callback'
228 * argument is provided and the argument in this position is a function
229 * instead of an object, it is considered as the next parameter
230 * 'callback', not this parameter 'methods'.
231 * @param {?function(...[*]) : *=} opt_callback: a callback function called
232 * when the iframe is closed.
233 *
234 * @return {iframes.Iframe} The opened iframe.
235 */
236 iframes.Iframes.prototype.open = function(
237 url, openParams, params, opt_methods, opt_callback) {};
238
239 /**
240 * Closes this iframe.
241 *
242 * @param {*=} opt_params The parameters to pass back to the parent iframe.
243 * @param {?function(...[*]) : *=} opt_callback The callback function after
244 * parent processed the event.
245 */
246 iframes.Iframes.prototype.close = function(opt_params, opt_callback) {};
247
248 /**
249 * Indicates that this iframe is ready. The exactly semantic depends on
250 * the style handler, but generally it means ready to be displayed and
251 * it should be called the page is drawn and initial data loaded.
252 *
253 * @param {Object=} opt_params The parameters to pass back to the parent iframe.
254 * @param {Object|function(...[*]) : *=} opt_methods: Functions to passed to
255 * the iframe. All properties should be functions. If no 'callback'
256 * argument is provided and the argument in this position is a function
257 * instead of an object, it is considered as the next parameter
258 * 'callback', not this parameter 'methods'.
259 * @param {?function(...[*]) : *=} opt_callback The callback function after
260 * parent processed the event.
261 */
262 iframes.Iframes.prototype.ready = function(
263 opt_params, opt_methods, opt_callback) {};
264
265 /**
266 * Passes the parent's origin and referer to the callback.
267 * @param {Function} callback Function
268 * that will get parent info passed to it.
269 */
270 iframes.Iframes.prototype.getParentInfo = function(callback) {};
271
272 /**
273 * Export browser events to your opener.
274 * @param {Array.<string>} events List of events to export. Currently only
275 * supports mouseover and mouseout.
276 */
277 iframes.Iframes.prototype.propagate = function(events) {};
278
279 /**
280 * Asks the parent window to change the width and height of this iframe.
281 *
282 * @param {Object} params The width and/or height in number of pixels to be
283 * resized. Use 'height': 'auto' for current window content height.
284 */
285
286 iframes.Iframes.prototype.resize = function(params) {};
287
288 /**
289 * @param {Object} params
290 * @deprecated
291 */
292 iframes.Iframes.prototype.resizeMe = function(params) {};
293
294 /**
295 * @return {string} The full URI for the Google Connect JS bundle.
296 */
297 iframes.Iframes.prototype.getGoogleConnectJsUri = function() {};
298
299 /**
300 * Allows client to override the Google Connect JS to use.
301 * @param {string} version The versioned JS file to use.
302 */
303 iframes.Iframes.prototype.setGoogleConnectJsVersion = function(version) {};
304
305 /**
306 * Allows the client to use a different JS hint.
307 * @param {string} hint The JS hint to use.
308 */
309 iframes.Iframes.prototype.setJsHint = function(hint) {};
310
311 /**
312 * Allows the client to use a different bootstrap hint.
313 * @param {string} hint The bootstrap hint to use.
314 */
315 iframes.Iframes.prototype.setBootstrapHint = function(hint) {};
316
317 /**
318 * @param {string} version
319 * @deprecated
320 */
321 iframes.Iframes.prototype.setVersionOverride = function(version) {};
322
323 /**
324 * Inside an iframe, the properties of the iframer object are the data and
325 * functions provided in iframes.open.
326 * @type {!Object|undefined}
327 */
328 Window.prototype.iframer = {};
329
330 /**
331 * Inside an iframe, the properties of the iframer object are the data and
332 * functions provided in iframes.open.
333 * @type {!Object|undefined}
334 */
335 iframes.Iframes.prototype.iframer = {};
336
337 /**
338 * Inside an iframe, the properties of the iframer object are the data and
339 * functions provided in iframes.open.
340 * @type {!Object}
341 */
342 var iframer = {};
343
344 /**
345 * Send a message to the parent.
346 * @param {string} message The message name.
347 * @param {*=} opt_data Optional data to pass.
348 * @param {Function=} opt_callback Optional callback to handle response.
349 * @param {Function=} opt_filter Optional iframes filter (not used).
350 */
351 iframer.send = function(message, opt_data, opt_callback, opt_filter) {};
352
353 /**
354 * Send a message to the iframe.
355 * @param {string} message The message name.
356 * @param {*=} opt_data Optional data to pass.
357 * @param {Function=} opt_callback Optional callback to handle response.
358 * @param {Function=} opt_filter Optional iframes filter (not used).
359 */
360 iframes.Iframe.prototype.send = function(
361 message, opt_data, opt_callback, opt_filter) {};
362
363 /**
364 * Register an handler for messages from the iframe.
365 * @param {string} message The message name.
366 * @param {Function} callback Message handler.
367 * @param {Function=} opt_filter Optional iframes filter (not used).
368 */
369 iframes.Iframe.prototype.register = function(message, callback, opt_filter) {};