Demo/bin/Debug/front_end/resources/ServiceWorkersView.js
(开头部分) 22KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Copyright (c) 2015 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}
* @implements {WebInspector.TargetManager.Observer}
*/
WebInspector.ServiceWorkersView = function()
{
WebInspector.VBox.call(this, true);
this.registerRequiredCSS("resources/serviceWorkersView.css");
this.contentElement.classList.add("service-workers-view");
/** @type {!Set.<string>} */
this._securityOriginHosts = new Set();
/** @type {!Map.<string, !WebInspector.ServiceWorkerOriginElement>} */
this._originHostToOriginElementMap = new Map();
/** @type {!Map.<string, !WebInspector.ServiceWorkerOriginElement>} */
this._registrationIdToOriginElementMap = new Map();
var settingsDiv = createElementWithClass("div", "service-workers-settings");
var debugOnStartCheckboxLabel = createCheckboxLabel(WebInspector.UIString("Open DevTools window and pause JavaScript execution on Service Worker startup for debugging."));
this._debugOnStartCheckbox = debugOnStartCheckboxLabel.checkboxElement;
this._debugOnStartCheckbox.addEventListener("change", this._debugOnStartCheckboxChanged.bind(this), false)
this._debugOnStartCheckbox.disabled = true
settingsDiv.appendChild(debugOnStartCheckboxLabel);
this.contentElement.appendChild(settingsDiv);
this._root = this.contentElement.createChild("ol");
this._root.classList.add("service-workers-root");
WebInspector.targetManager.observeTargets(this);
}
WebInspector.ServiceWorkersView.prototype = {
/**
* @override
* @param {!WebInspector.Target} target
*/
targetAdded: function(target)
{
if (this._target)
return;
this._target = target;
this._manager = this._target.serviceWorkerManager;
this._debugOnStartCheckbox.disabled = false;
this._debugOnStartCheckbox.checked = this._manager.debugOnStart();
for (var registration of this._manager.registrations().values())
this._updateRegistration(registration);
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationUpdated, this._registrationUpdated, this);
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationDeleted, this._registrationDeleted, this);
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.DebugOnStartUpdated, this._debugOnStartUpdated, this);
this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
var securityOrigins = this._target.resourceTreeModel.securityOrigins();
后面还有 487 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。