Demo/bin/Debug/front_end/sources/JavaScriptCompiler.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
 * @param {!WebInspector.JavaScriptSourceFrame} sourceFrame
 */
WebInspector.JavaScriptCompiler = function(sourceFrame)
{
    this._sourceFrame = sourceFrame;
    this._compiling = false;
}

WebInspector.JavaScriptCompiler.CompileDelay = 1000;

WebInspector.JavaScriptCompiler.prototype = {
    scheduleCompile: function()
    {
        if (this._compiling) {
            this._recompileScheduled = true;
            return;
        }
        if (this._timeout)
            clearTimeout(this._timeout);
        this._timeout = setTimeout(this._compile.bind(this), WebInspector.JavaScriptCompiler.CompileDelay);
    },

    /**
     * @return {?WebInspector.Target}
     */
    _findTarget: function()
    {
        var targets = WebInspector.targetManager.targets();
        var sourceCode = this._sourceFrame.uiSourceCode();
        for (var i = 0; i < targets.length; ++i) {
            var scriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(sourceCode, targets[i]);
            if (scriptFile)
                return targets[i];
        }
        return WebInspector.targetManager.mainTarget();
    },

    _compile: function()
    {
        var target = this._findTarget();
        if (!target)
            return;
        var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
        if (!debuggerModel)
            return;

        this._compiling = true;
        var code = this._sourceFrame.textEditor.text();
        debuggerModel.compileScript(code, "", false, undefined, compileCallback.bind(this, target));

        /**
         * @param {!WebInspector.Target} target
         * @param {!DebuggerAgent.ScriptId=} scriptId
         * @param {?DebuggerAgent.ExceptionDetails=} exceptionDetails
后面还有 20 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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