_updateGlows (optExtraThreads) {
        const searchThreads = [];
        searchThreads.push.apply(searchThreads, this.threads);
        if (optExtraThreads) {
            searchThreads.push.apply(searchThreads, optExtraThreads);
        }
        // Set of scripts that request a glow this frame.
        const requestedGlowsThisFrame = [];
        // Final set of scripts glowing during this frame.
        const finalScriptGlows = [];
        // Find all scripts that should be glowing.
        for (let i = 0; i < searchThreads.length; i++) {
            const thread = searchThreads[i];
            const target = thread.target;
            if (target === this._editingTarget) {
                const blockForThread = thread.blockGlowInFrame;
                if (thread.requestScriptGlowInFrame) {
                    let script = target.blocks.getTopLevelScript(blockForThread);
                    if (!script) {
                        // Attempt to find in flyout blocks.
                        script = this.flyoutBlocks.getTopLevelScript(
                            blockForThread
                        );
                    }
                    if (script) {
                        requestedGlowsThisFrame.push(script);
                    }
                }
            }
        }
        // Compare to previous frame.
        for (let j = 0; j < this._scriptGlowsPreviousFrame.length; j++) {
            const previousFrameGlow = this._scriptGlowsPreviousFrame[j];
            if (requestedGlowsThisFrame.indexOf(previousFrameGlow) < 0) {
                // Glow turned off.
                this.glowScript(previousFrameGlow, false);
            } else {
                // Still glowing.
                finalScriptGlows.push(previousFrameGlow);
            }
        }
        for (let k = 0; k < requestedGlowsThisFrame.length; k++) {
            const currentFrameGlow = requestedGlowsThisFrame[k];
            if (this._scriptGlowsPreviousFrame.indexOf(currentFrameGlow) < 0) {
                // Glow turned on.
                this.glowScript(currentFrameGlow, true);
                finalScriptGlows.push(currentFrameGlow);
            }
        }
        this._scriptGlowsPreviousFrame = finalScriptGlows;
    }
/**
     * Emit glows/glow clears for scripts after a single tick.
     * Looks at `this.threads` and notices which have turned on/off new glows.
     * @param {Array.<Thread>=} optExtraThreads Optional list of inactive threads.
     */
Emit glows/glow clears for scripts after a single tick.
Looks at `this.threads` and notices which have turned on/off new glows.
@param {Array.=} optExtraThreads Optional list of inactive threads.
Emit glows / glow clears for scripts after a single tick . Looks at ` this . threads ` and notices which have turned on / off new glows . @param { Array . = } optExtraThreads Optional list of inactive threads .
_updateGlows (optExtraThreads) {
        const searchThreads = [];
        searchThreads.push.apply(searchThreads, this.threads);
        if (optExtraThreads) {
            searchThreads.push.apply(searchThreads, optExtraThreads);
        }
        const requestedGlowsThisFrame = [];
        const finalScriptGlows = [];
        for (let i = 0; i < searchThreads.length; i++) {
            const thread = searchThreads[i];
            const target = thread.target;
            if (target === this._editingTarget) {
                const blockForThread = thread.blockGlowInFrame;
                if (thread.requestScriptGlowInFrame) {
                    let script = target.blocks.getTopLevelScript(blockForThread);
                    if (!script) {
                        script = this.flyoutBlocks.getTopLevelScript(
                            blockForThread
                        );
                    }
                    if (script) {
                        requestedGlowsThisFrame.push(script);
                    }
                }
            }
        }
        for (let j = 0; j < this._scriptGlowsPreviousFrame.length; j++) {
            const previousFrameGlow = this._scriptGlowsPreviousFrame[j];
            if (requestedGlowsThisFrame.indexOf(previousFrameGlow) < 0) {
                this.glowScript(previousFrameGlow, false);
            } else {
                finalScriptGlows.push(previousFrameGlow);
            }
        }
        for (let k = 0; k < requestedGlowsThisFrame.length; k++) {
            const currentFrameGlow = requestedGlowsThisFrame[k];
            if (this._scriptGlowsPreviousFrame.indexOf(currentFrameGlow) < 0) {
                this.glowScript(currentFrameGlow, true);
                finalScriptGlows.push(currentFrameGlow);
            }
        }
        this._scriptGlowsPreviousFrame = finalScriptGlows;
    }
_updateGlows ( optExtraThreads ) { const searchThreads = [ ] ; searchThreads . push . apply ( searchThreads , this . threads ) ; if ( optExtraThreads ) { searchThreads . push . apply ( searchThreads , optExtraThreads ) ; } const requestedGlowsThisFrame = [ ] ; const finalScriptGlows = [ ] ; for ( let i = 0 ; i < searchThreads . length ; i ++ ) { const thread = searchThreads [ i ] ; const target = thread . target ; if ( target === this . _editingTarget ) { const blockForThread = thread . blockGlowInFrame ; if ( thread . requestScriptGlowInFrame ) { let script = target . blocks . getTopLevelScript ( blockForThread ) ; if ( ! script ) { script = this . flyoutBlocks . getTopLevelScript ( blockForThread ) ; } if ( script ) { requestedGlowsThisFrame . push ( script ) ; } } } } for ( let j = 0 ; j < this . _scriptGlowsPreviousFrame . length ; j ++ ) { const previousFrameGlow = this . _scriptGlowsPreviousFrame [ j ] ; if ( requestedGlowsThisFrame . indexOf ( previousFrameGlow ) < 0 ) { this . glowScript ( previousFrameGlow , false ) ; } else { finalScriptGlows . push ( previousFrameGlow ) ; } } for ( let k = 0 ; k < requestedGlowsThisFrame . length ; k ++ ) { const currentFrameGlow = requestedGlowsThisFrame [ k ] ; if ( this . _scriptGlowsPreviousFrame . indexOf ( currentFrameGlow ) < 0 ) { this . glowScript ( currentFrameGlow , true ) ; finalScriptGlows . push ( currentFrameGlow ) ; } } this . _scriptGlowsPreviousFrame = finalScriptGlows ; }
Emit glows/glow clears for scripts after a single tick.
Emit glows / glow clears for scripts after a single tick .
// Set of scripts that request a glow this frame. // Final set of scripts glowing during this frame. // Find all scripts that should be glowing. // Attempt to find in flyout blocks. // Compare to previous frame. // Glow turned off. // Still glowing. // Glow turned on.