Demo/bin/Debug/front_end/ui/ShortcutRegistry.js
(开头部分) 6KB这里只显示每个文件的开头 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
* @param {!WebInspector.ActionRegistry} actionRegistry
* @param {!Document} document
*/
WebInspector.ShortcutRegistry = function(actionRegistry, document)
{
this._actionRegistry = actionRegistry;
/** @type {!Multimap.<string, string>} */
this._defaultKeyToActions = new Multimap();
/** @type {!Multimap.<string, !WebInspector.KeyboardShortcut.Descriptor>} */
this._defaultActionToShortcut = new Multimap();
this._registerBindings(document);
}
WebInspector.ShortcutRegistry.prototype = {
/**
* @param {number} key
* @return {!Array.<string>}
*/
applicableActions: function(key)
{
return this._actionRegistry.applicableActions(this._defaultActionsForKey(key).valuesArray(), WebInspector.context);
},
/**
* @param {number} key
* @return {!Set.<string>}
*/
_defaultActionsForKey: function(key)
{
return this._defaultKeyToActions.get(String(key));
},
/**
* @param {string} actionId
* @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>}
*/
shortcutDescriptorsForAction: function(actionId)
{
return this._defaultActionToShortcut.get(actionId).valuesArray();
},
/**
* @param {!Array.<string>} actionIds
* @return {!Array.<number>}
*/
keysForActions: function(actionIds)
{
var result = [];
for (var i = 0; i < actionIds.length; ++i) {
var descriptors = this.shortcutDescriptorsForAction(actionIds[i]);
for (var j = 0; j < descriptors.length; ++j)
result.push(descriptors[j].key);
}
return result;
后面还有 151 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。