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

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

Issue 1150173003: Fix some JS style nits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 6 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
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;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 function addSingletonGetter(ctor) { 291 function addSingletonGetter(ctor) {
292 ctor.getInstance = function() { 292 ctor.getInstance = function() {
293 return ctor.instance_ || (ctor.instance_ = new ctor()); 293 return ctor.instance_ || (ctor.instance_ = new ctor());
294 }; 294 };
295 } 295 }
296 296
297 /** 297 /**
298 * Forwards public APIs to private implementations. 298 * Forwards public APIs to private implementations.
299 * @param {Function} ctor Constructor that have private implementations in its 299 * @param {Function} ctor Constructor that have private implementations in its
300 * prototype. 300 * prototype.
301 * @param {Array.<string>} methods List of public method names that have their 301 * @param {Array<string>} methods List of public method names that have their
302 * underscored counterparts in constructor's prototype. 302 * underscored counterparts in constructor's prototype.
303 * @param {string=} opt_target Selector for target node. 303 * @param {string=} opt_target Selector for target node.
304 */ 304 */
305 function makePublic(ctor, methods, opt_target) { 305 function makePublic(ctor, methods, opt_target) {
306 methods.forEach(function(method) { 306 methods.forEach(function(method) {
307 ctor[method] = function() { 307 ctor[method] = function() {
308 var target = opt_target ? document.getElementById(opt_target) : 308 var target = opt_target ? document.getElementById(opt_target) :
309 ctor.getInstance(); 309 ctor.getInstance();
310 return target[method + '_'].apply(target, arguments); 310 return target[method + '_'].apply(target, arguments);
311 }; 311 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 return /Linux/.test(navigator.userAgent); 348 return /Linux/.test(navigator.userAgent);
349 }, 349 },
350 350
351 /** Whether this uses the views toolkit or not. */ 351 /** Whether this uses the views toolkit or not. */
352 get isViews() { 352 get isViews() {
353 return typeof chrome.getVariableValue == 'function' && 353 return typeof chrome.getVariableValue == 'function' &&
354 /views/.test(chrome.getVariableValue('toolkit')); 354 /views/.test(chrome.getVariableValue('toolkit'));
355 }, 355 },
356 }; 356 };
357 }(); 357 }();
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/v0_8/cr_events/cr_events.js ('k') | ui/webui/resources/js/cr/link_controller.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698