Demo/bin/Debug/front_end/ui/ActionRegistry.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
 */
WebInspector.ActionRegistry = function()
{
    /** @type {!Map.<string, !Runtime.Extension>} */
    this._actionsById = new Map();
    this._registerActions();
}

WebInspector.ActionRegistry.prototype = {
    _registerActions: function()
    {
        self.runtime.extensions(WebInspector.ActionDelegate).forEach(registerExtension, this);

        /**
         * @param {!Runtime.Extension} extension
         * @this {WebInspector.ActionRegistry}
         */
        function registerExtension(extension)
        {
            var actionId = extension.descriptor()["actionId"];
            console.assert(actionId);
            console.assert(!this._actionsById.get(actionId));
            this._actionsById.set(actionId, extension);
        }
    },

    /**
     * @param {!Array.<string>} actionIds
     * @param {!WebInspector.Context} context
     * @return {!Array.<string>}
     */
    applicableActions: function(actionIds, context)
    {
        var extensions = [];
        actionIds.forEach(function(actionId) {
           var extension = this._actionsById.get(actionId);
           if (extension)
               extensions.push(extension);
        }, this);
        return context.applicableExtensions(extensions).valuesArray().map(function(extension) {
            return extension.descriptor()["actionId"];
        });
    },

    /**
     * @param {string} actionId
     * @return {!Promise.<undefined>}
     */
    execute: function(actionId)
    {
        var extension = this._actionsById.get(actionId);
        console.log("ActionRegistry actionId:" + actionId);
        
        console.assert(extension, "No action found for actionId '" + actionId + "'");
后面还有 30 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。