Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: ui/webui/resources/js/cr.js

Issue 1685503002: Fix closure compile by fixing @typedef in cr.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * The global object. 6 * The global object.
7 * @type {!Object} 7 * @type {!Object}
8 * @const 8 * @const
9 */ 9 */
10 var global = this; 10 var global = this;
11 11
12 /** @typedef {{eventName: string, uid: number}} */
13 var WebUIListener;
14
12 /** Platform, package, object property, and Event support. **/ 15 /** Platform, package, object property, and Event support. **/
13 var cr = function() { 16 var cr = function() {
14 'use strict'; 17 'use strict';
15 18
16 /** 19 /**
17 * Builds an object structure for the provided namespace path, 20 * Builds an object structure for the provided namespace path,
18 * ensuring that names that already exist are not overwritten. For 21 * ensuring that names that already exist are not overwritten. For
19 * example: 22 * example:
20 * "a.b.c" -> a = {};a.b={};a.b.c={}; 23 * "a.b.c" -> a = {};a.b={};a.b.c={};
21 * @param {string} name Name of the object that this file defines. 24 * @param {string} name Name of the object that this file defines.
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 return; 384 return;
382 } 385 }
383 386
384 var args = Array.prototype.slice.call(arguments, 1); 387 var args = Array.prototype.slice.call(arguments, 1);
385 for (var listenerId in eventListenersMap) { 388 for (var listenerId in eventListenersMap) {
386 eventListenersMap[listenerId].apply(null, args); 389 eventListenersMap[listenerId].apply(null, args);
387 } 390 }
388 } 391 }
389 392
390 /** 393 /**
391 * @typedef {{
392 * eventName: string,
393 * uid: number,
394 * }}
395 */
396 var WebUIListener;
397
398 /**
399 * Registers a listener for an event fired from WebUI handlers. Any number of 394 * Registers a listener for an event fired from WebUI handlers. Any number of
400 * listeners may register for a single event. 395 * listeners may register for a single event.
401 * @param {string} eventName The event to listen to. 396 * @param {string} eventName The event to listen to.
402 * @param {!Function} callback The callback run when the event is fired. 397 * @param {!Function} callback The callback run when the event is fired.
403 * @return {!WebUIListener} An object to be used for removing a listener via 398 * @return {!WebUIListener} An object to be used for removing a listener via
404 * cr.removeWebUIListener. Should be treated as read-only. 399 * cr.removeWebUIListener. Should be treated as read-only.
405 */ 400 */
406 function addWebUIListener(eventName, callback) { 401 function addWebUIListener(eventName, callback) {
407 webUIListenerMap[eventName] = webUIListenerMap[eventName] || {}; 402 webUIListenerMap[eventName] = webUIListenerMap[eventName] || {};
408 var uid = createUid(); 403 var uid = createUid();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 get isLinux() { 464 get isLinux() {
470 return /Linux/.test(navigator.userAgent); 465 return /Linux/.test(navigator.userAgent);
471 }, 466 },
472 467
473 /** Whether this is on Android. */ 468 /** Whether this is on Android. */
474 get isAndroid() { 469 get isAndroid() {
475 return /Android/.test(navigator.userAgent); 470 return /Android/.test(navigator.userAgent);
476 } 471 }
477 }; 472 };
478 }(); 473 }();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698