Demo/bin/Debug/front_end/ui/Context.js
(开头部分) 3KB这里只显示每个文件的开头 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
*/
WebInspector.Context = function()
{
this._flavors = new Map();
this._eventDispatchers = new Map();
}
/**
* @enum {string}
*/
WebInspector.Context.Events = {
FlavorChanged: "FlavorChanged"
}
WebInspector.Context.prototype = {
/**
* @param {function(new:T, ...)} flavorType
* @param {?T} flavorValue
* @template T
*/
setFlavor: function(flavorType, flavorValue)
{
var value = this._flavors.get(flavorType) || null;
if (value === flavorValue)
return;
if (flavorValue)
this._flavors.set(flavorType, flavorValue);
else
this._flavors.remove(flavorType);
this._dispatchFlavorChange(flavorType, flavorValue);
},
/**
* @param {function(new:T, ...)} flavorType
* @param {?T} flavorValue
* @template T
*/
_dispatchFlavorChange: function(flavorType, flavorValue)
{
var dispatcher = this._eventDispatchers.get(flavorType);
if (!dispatcher)
return;
dispatcher.dispatchEventToListeners(WebInspector.Context.Events.FlavorChanged, flavorValue);
},
/**
* @param {function(new:Object, ...)} flavorType
* @param {function(!WebInspector.Event)} listener
* @param {!Object=} thisObject
*/
addFlavorChangeListener: function(flavorType, listener, thisObject)
{
var dispatcher = this._eventDispatchers.get(flavorType);
后面还有 59 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。