Demo/bin/Debug/front_end/network/EventSourceMessagesView.js
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// 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
*/
WebInspector.EventSourceMessagesView = function(request)
{
WebInspector.VBox.call(this);
this.registerRequiredCSS("network/eventSourceMessagesView.css");
this.element.classList.add("event-source-messages-view");
this._request = request;
var columns = [
{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._sortItems();
this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this);
this._dataGrid.setName("EventSourceMessagesView");
this._dataGrid.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);
},
willHide: function()
{
this._request.removeEventListener(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));
},
_sortItems: function()
{
后面还有 51 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。