Demo/bin/Debug/front_end/sources/ServiceWorkersSidebarPane.js
(开头部分) 2KB这里只显示每个文件的开头 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.SidebarPane}
* @implements {WebInspector.TargetManager.Observer}
*/
WebInspector.ServiceWorkersSidebarPane = function()
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("\u2699 Service Workers"));
this.registerRequiredCSS("sources/serviceWorkersSidebar.css");
this._bodyElement = this.element.createChild("div", "vbox");
this.setVisible(false);
/** @type {?WebInspector.ServiceWorkerManager} */
this._manager = null;
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Page);
this._placeholderElement = createElementWithClass("div", "info");
this._placeholderElement.textContent = WebInspector.UIString("No service workers control this page");
}
WebInspector.ServiceWorkersSidebarPane.prototype = {
/**
* @override
* @param {!WebInspector.Target} target
*/
targetAdded: function(target)
{
if (this._manager)
return;
this._manager = target.serviceWorkerManager;
this._updateVisibility();
target.serviceWorkerManager.addEventListener(WebInspector.ServiceWorkerManager.Events.WorkersUpdated, this._update, this);
},
/**
* @override
* @param {!WebInspector.Target} target
*/
targetRemoved: function(target)
{
target.serviceWorkerManager.removeEventListener(WebInspector.ServiceWorkerManager.Events.WorkersUpdated, this._update, this);
this._updateVisibility();
},
_update: function()
{
this._updateVisibility();
this._bodyElement.removeChildren();
if (!this.isShowing() || !this._manager)
return;
if (!this._manager.hasWorkers()) {
this._bodyElement.appendChild(this._placeholderElement);
return;
}
后面还有 24 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。