Demo/bin/Debug/front_end/profiler/TargetsComboBoxController.js
(开头部分) 2KB这里只显示每个文件的开头 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
* @implements {WebInspector.TargetManager.Observer}
* @param {!Element} selectElement
* @param {!Element} elementToHide
*/
WebInspector.TargetsComboBoxController = function(selectElement, elementToHide)
{
elementToHide.classList.add("hidden");
selectElement.addEventListener("change", this._onComboBoxSelectionChange.bind(this), false);
this._selectElement = selectElement;
this._elementToHide = elementToHide;
/** @type {!Map.<!WebInspector.Target, !Element>} */
this._targetToOption = new Map();
WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targetChangedExternally, this);
WebInspector.targetManager.observeTargets(this);
}
WebInspector.TargetsComboBoxController.prototype = {
/**
* @override
* @param {!WebInspector.Target} target
*/
targetAdded: function(target)
{
if (!target.hasJSContext())
return;
var option = this._selectElement.createChild("option");
option.text = target.name();
option.__target = target;
this._targetToOption.set(target, option);
if (WebInspector.context.flavor(WebInspector.Target) === target)
this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @type {?} */ (this._selectElement), option);
this._updateVisibility();
},
/**
* @override
* @param {!WebInspector.Target} target
*/
targetRemoved: function(target)
{
if (!target.hasJSContext())
return;
var option = this._targetToOption.remove(target);
this._selectElement.removeChild(option);
this._updateVisibility();
},
_onComboBoxSelectionChange: function()
{
var selectedOption = this._selectElement[this._selectElement.selectedIndex];
if (!selectedOption)
后面还有 32 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。