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

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/Console.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/common/Console.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Console.js b/third_party/WebKit/Source/devtools/front_end/common/Console.js
index 3b2921d3e8655e280521b24b78176c629a4402c3..2dbe2412037732c622f55fd52cf758e90ba8f3df 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Console.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Console.js
@@ -1,105 +1,98 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
/**
- * @constructor
- * @extends {WebInspector.Object}
+ * @unrestricted
*/
-WebInspector.Console = function()
-{
+WebInspector.Console = class extends WebInspector.Object {
+ constructor() {
+ super();
/** @type {!Array.<!WebInspector.Console.Message>} */
this._messages = [];
+ }
+
+ /**
+ * @param {string} text
+ * @param {!WebInspector.Console.MessageLevel} level
+ * @param {boolean=} show
+ */
+ addMessage(text, level, show) {
+ var message = new WebInspector.Console.Message(
+ text, level || WebInspector.Console.MessageLevel.Log, Date.now(), show || false);
+ this._messages.push(message);
+ this.dispatchEventToListeners(WebInspector.Console.Events.MessageAdded, message);
+ }
+
+ /**
+ * @param {string} text
+ */
+ log(text) {
+ this.addMessage(text, WebInspector.Console.MessageLevel.Log);
+ }
+
+ /**
+ * @param {string} text
+ */
+ warn(text) {
+ this.addMessage(text, WebInspector.Console.MessageLevel.Warning);
+ }
+
+ /**
+ * @param {string} text
+ */
+ error(text) {
+ this.addMessage(text, WebInspector.Console.MessageLevel.Error, true);
+ }
+
+ /**
+ * @return {!Array.<!WebInspector.Console.Message>}
+ */
+ messages() {
+ return this._messages;
+ }
+
+ show() {
+ this.showPromise();
+ }
+
+ /**
+ * @return {!Promise.<undefined>}
+ */
+ showPromise() {
+ return WebInspector.Revealer.revealPromise(this);
+ }
};
/** @enum {symbol} */
WebInspector.Console.Events = {
- MessageAdded: Symbol("messageAdded")
+ MessageAdded: Symbol('messageAdded')
};
/**
* @enum {string}
*/
WebInspector.Console.MessageLevel = {
- Log: "log",
- Warning: "warning",
- Error: "error"
+ Log: 'log',
+ Warning: 'warning',
+ Error: 'error'
};
/**
- * @constructor
- * @param {string} text
- * @param {!WebInspector.Console.MessageLevel} level
- * @param {number} timestamp
- * @param {boolean} show
+ * @unrestricted
*/
-WebInspector.Console.Message = function(text, level, timestamp, show)
-{
+WebInspector.Console.Message = class {
+ /**
+ * @param {string} text
+ * @param {!WebInspector.Console.MessageLevel} level
+ * @param {number} timestamp
+ * @param {boolean} show
+ */
+ constructor(text, level, timestamp, show) {
this.text = text;
this.level = level;
- this.timestamp = (typeof timestamp === "number") ? timestamp : Date.now();
+ this.timestamp = (typeof timestamp === 'number') ? timestamp : Date.now();
this.show = show;
-};
-
-WebInspector.Console.prototype = {
- /**
- * @param {string} text
- * @param {!WebInspector.Console.MessageLevel} level
- * @param {boolean=} show
- */
- addMessage: function(text, level, show)
- {
- var message = new WebInspector.Console.Message(text, level || WebInspector.Console.MessageLevel.Log, Date.now(), show || false);
- this._messages.push(message);
- this.dispatchEventToListeners(WebInspector.Console.Events.MessageAdded, message);
- },
-
- /**
- * @param {string} text
- */
- log: function(text)
- {
- this.addMessage(text, WebInspector.Console.MessageLevel.Log);
- },
-
- /**
- * @param {string} text
- */
- warn: function(text)
- {
- this.addMessage(text, WebInspector.Console.MessageLevel.Warning);
- },
-
- /**
- * @param {string} text
- */
- error: function(text)
- {
- this.addMessage(text, WebInspector.Console.MessageLevel.Error, true);
- },
-
- /**
- * @return {!Array.<!WebInspector.Console.Message>}
- */
- messages: function()
- {
- return this._messages;
- },
-
- show: function()
- {
- this.showPromise();
- },
-
- /**
- * @return {!Promise.<undefined>}
- */
- showPromise: function()
- {
- return WebInspector.Revealer.revealPromise(this);
- },
-
- __proto__: WebInspector.Object.prototype
+ }
};
WebInspector.console = new WebInspector.Console();

Powered by Google App Engine
This is Rietveld 408576698