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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.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/network/EventSourceMessagesView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.js b/third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.js
index d0cb4edd997009448714e06e25c6754f2e1a55db..14e3419eee3b4fae90bba57319cc4e20f12487c3 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.js
@@ -1,93 +1,93 @@
// 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.VBox}
- * @param {!WebInspector.NetworkRequest} request
+ * @unrestricted
*/
-WebInspector.EventSourceMessagesView = function(request)
-{
- WebInspector.VBox.call(this);
- this.registerRequiredCSS("network/eventSourceMessagesView.css");
- this.element.classList.add("event-source-messages-view");
+WebInspector.EventSourceMessagesView = class extends WebInspector.VBox {
+ /**
+ * @param {!WebInspector.NetworkRequest} request
+ */
+ constructor(request) {
+ super();
+ this.registerRequiredCSS('network/eventSourceMessagesView.css');
+ this.element.classList.add('event-source-messages-view');
this._request = request;
var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([
- {id: "id", title: WebInspector.UIString("Id"), sortable: true, weight: 8},
- {id: "type", title: WebInspector.UIString("Type"), sortable: true, weight: 8},
- {id: "data", title: WebInspector.UIString("Data"), sortable: false, weight: 88},
- {id: "time", title: WebInspector.UIString("Time"), sortable: true, weight: 8}
+ {id: 'id', title: WebInspector.UIString('Id'), sortable: true, weight: 8},
+ {id: 'type', title: WebInspector.UIString('Type'), sortable: true, weight: 8},
+ {id: 'data', title: WebInspector.UIString('Data'), sortable: false, weight: 88},
+ {id: 'time', title: WebInspector.UIString('Time'), sortable: true, weight: 8}
]);
this._dataGrid = new WebInspector.SortableDataGrid(columns);
this._dataGrid.setStickToBottom(true);
- this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Ascending);
+ this._dataGrid.markColumnAsSortedBy('time', WebInspector.DataGrid.Order.Ascending);
this._sortItems();
this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this);
- this._dataGrid.setName("EventSourceMessagesView");
+ this._dataGrid.setName('EventSourceMessagesView');
this._dataGrid.asWidget().show(this.element);
-};
-
-WebInspector.EventSourceMessagesView.prototype = {
- wasShown: function()
- {
- this._dataGrid.rootNode().removeChildren();
- var messages = this._request.eventSourceMessages();
- for (var i = 0; i < messages.length; ++i)
- this._dataGrid.insertChild(new WebInspector.EventSourceMessageNode(messages[i]));
+ }
- this._request.addEventListener(WebInspector.NetworkRequest.Events.EventSourceMessageAdded, this._messageAdded, this);
- },
+ /**
+ * @override
+ */
+ wasShown() {
+ this._dataGrid.rootNode().removeChildren();
+ var messages = this._request.eventSourceMessages();
+ for (var i = 0; i < messages.length; ++i)
+ this._dataGrid.insertChild(new WebInspector.EventSourceMessageNode(messages[i]));
- willHide: function()
- {
- this._request.removeEventListener(WebInspector.NetworkRequest.Events.EventSourceMessageAdded, this._messageAdded, this);
- },
+ this._request.addEventListener(
+ WebInspector.NetworkRequest.Events.EventSourceMessageAdded, this._messageAdded, this);
+ }
- /**
- * @param {!WebInspector.Event} event
- */
- _messageAdded: function(event)
- {
- var message = /** @type {!WebInspector.NetworkRequest.EventSourceMessage} */ (event.data);
- this._dataGrid.insertChild(new WebInspector.EventSourceMessageNode(message));
- },
+ /**
+ * @override
+ */
+ willHide() {
+ this._request.removeEventListener(
+ WebInspector.NetworkRequest.Events.EventSourceMessageAdded, this._messageAdded, this);
+ }
- _sortItems: function()
- {
- var sortColumnId = this._dataGrid.sortColumnId();
- if (!sortColumnId)
- return;
- var comparator = WebInspector.EventSourceMessageNode.Comparators[sortColumnId];
- if (!comparator)
- return;
- this._dataGrid.sortNodes(comparator, !this._dataGrid.isSortOrderAscending());
- },
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _messageAdded(event) {
+ var message = /** @type {!WebInspector.NetworkRequest.EventSourceMessage} */ (event.data);
+ this._dataGrid.insertChild(new WebInspector.EventSourceMessageNode(message));
+ }
- __proto__: WebInspector.VBox.prototype
+ _sortItems() {
+ var sortColumnId = this._dataGrid.sortColumnId();
+ if (!sortColumnId)
+ return;
+ var comparator = WebInspector.EventSourceMessageNode.Comparators[sortColumnId];
+ if (!comparator)
+ return;
+ this._dataGrid.sortNodes(comparator, !this._dataGrid.isSortOrderAscending());
+ }
};
/**
- * @constructor
- * @extends {WebInspector.SortableDataGridNode}
- * @param {!WebInspector.NetworkRequest.EventSourceMessage} message
+ * @unrestricted
*/
-WebInspector.EventSourceMessageNode = function(message)
-{
+WebInspector.EventSourceMessageNode = class extends WebInspector.SortableDataGridNode {
+ /**
+ * @param {!WebInspector.NetworkRequest.EventSourceMessage} message
+ */
+ constructor(message) {
var time = new Date(message.time * 1000);
- var timeText = ("0" + time.getHours()).substr(-2) + ":" + ("0" + time.getMinutes()).substr(-2) + ":" + ("0" + time.getSeconds()).substr(-2) + "." + ("00" + time.getMilliseconds()).substr(-3);
- var timeNode = createElement("div");
+ var timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMinutes()).substr(-2) + ':' +
+ ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMilliseconds()).substr(-3);
+ var timeNode = createElement('div');
timeNode.createTextChild(timeText);
timeNode.title = time.toLocaleString();
- WebInspector.SortableDataGridNode.call(this, {id: message.eventId, type: message.eventName, data: message.data, time: timeNode});
+ super({id: message.eventId, type: message.eventName, data: message.data, time: timeNode});
this._message = message;
-};
-
-WebInspector.EventSourceMessageNode.prototype = {
- __proto__: WebInspector.SortableDataGridNode.prototype
+ }
};
/**
@@ -96,16 +96,15 @@ WebInspector.EventSourceMessageNode.prototype = {
* @param {!WebInspector.EventSourceMessageNode} b
* @return {number}
*/
-WebInspector.EventSourceMessageNodeComparator = function(field, a, b)
-{
- var aValue = a._message[field];
- var bValue = b._message[field];
- return aValue < bValue ? -1 : aValue > bValue ? 1 : 0;
+WebInspector.EventSourceMessageNodeComparator = function(field, a, b) {
+ var aValue = a._message[field];
+ var bValue = b._message[field];
+ return aValue < bValue ? -1 : aValue > bValue ? 1 : 0;
};
/** @type {!Object.<string, !WebInspector.SortableDataGrid.NodeComparator>} */
WebInspector.EventSourceMessageNode.Comparators = {
- "id": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventId"),
- "type": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventName"),
- "time": WebInspector.EventSourceMessageNodeComparator.bind(null, "time")
+ 'id': WebInspector.EventSourceMessageNodeComparator.bind(null, 'eventId'),
+ 'type': WebInspector.EventSourceMessageNodeComparator.bind(null, 'eventName'),
+ 'time': WebInspector.EventSourceMessageNodeComparator.bind(null, 'time')
};

Powered by Google App Engine
This is Rietveld 408576698