_registerExtensionPrimitives (extensionInfo) {
        const categoryInfo = {
            id: extensionInfo.id,
            name: extensionInfo.name,
            iconURI: extensionInfo.iconURI,
            color1: '#FF6680',
            color2: '#FF4D6A',
            color3: '#FF3355',
            blocks: [],
            menus: []
        };

        this._blockInfo.push(categoryInfo);

        for (const menuName in extensionInfo.menus) {
            if (extensionInfo.menus.hasOwnProperty(menuName)) {
                const menuItems = extensionInfo.menus[menuName];
                const convertedMenu = this._buildMenuForScratchBlocks(menuName, menuItems, categoryInfo);
                categoryInfo.menus.push(convertedMenu);
            }
        }
        for (const blockInfo of extensionInfo.blocks) {
            const convertedBlock = this._convertForScratchBlocks(blockInfo, categoryInfo);
            const opcode = convertedBlock.json.type;
            categoryInfo.blocks.push(convertedBlock);
            this._primitives[opcode] = convertedBlock.info.func;
            if (blockInfo.blockType === BlockType.HAT) {
                this._hats[opcode] = {edgeActivated: true}; /** @TODO let extension specify this */
            }
        }

        this.emit(Runtime.EXTENSION_ADDED, categoryInfo.blocks.concat(categoryInfo.menus));
    }
/**
     * Register the primitives provided by an extension.
     * @param {ExtensionInfo} extensionInfo - information about the extension (id, blocks, etc.)
     * @private
     */
Register the primitives provided by an extension.
@param {ExtensionInfo} extensionInfo - information about the extension (id, blocks, etc.)
@private
Register the primitives provided by an extension . @param { ExtensionInfo } extensionInfo - information about the extension ( id blocks etc . ) @private
_registerExtensionPrimitives (extensionInfo) {
        const categoryInfo = {
            id: extensionInfo.id,
            name: extensionInfo.name,
            iconURI: extensionInfo.iconURI,
            color1: '#FF6680',
            color2: '#FF4D6A',
            color3: '#FF3355',
            blocks: [],
            menus: []
        };
        this._blockInfo.push(categoryInfo);
        for (const menuName in extensionInfo.menus) {
            if (extensionInfo.menus.hasOwnProperty(menuName)) {
                const menuItems = extensionInfo.menus[menuName];
                const convertedMenu = this._buildMenuForScratchBlocks(menuName, menuItems, categoryInfo);
                categoryInfo.menus.push(convertedMenu);
            }
        }
        for (const blockInfo of extensionInfo.blocks) {
            const convertedBlock = this._convertForScratchBlocks(blockInfo, categoryInfo);
            const opcode = convertedBlock.json.type;
            categoryInfo.blocks.push(convertedBlock);
            this._primitives[opcode] = convertedBlock.info.func;
            if (blockInfo.blockType === BlockType.HAT) {
                this._hats[opcode] = {edgeActivated: true}; 
            }
        }
        this.emit(Runtime.EXTENSION_ADDED, categoryInfo.blocks.concat(categoryInfo.menus));
    }
_registerExtensionPrimitives ( extensionInfo ) { const categoryInfo = { id : extensionInfo . id , name : extensionInfo . name , iconURI : extensionInfo . iconURI , color1 : '#FF6680' , color2 : '#FF4D6A' , color3 : '#FF3355' , blocks : [ ] , menus : [ ] } ; this . _blockInfo . push ( categoryInfo ) ; for ( const menuName in extensionInfo . menus ) { if ( extensionInfo . menus . hasOwnProperty ( menuName ) ) { const menuItems = extensionInfo . menus [ menuName ] ; const convertedMenu = this . _buildMenuForScratchBlocks ( menuName , menuItems , categoryInfo ) ; categoryInfo . menus . push ( convertedMenu ) ; } } for ( const blockInfo of extensionInfo . blocks ) { const convertedBlock = this . _convertForScratchBlocks ( blockInfo , categoryInfo ) ; const opcode = convertedBlock . json . type ; categoryInfo . blocks . push ( convertedBlock ) ; this . _primitives [ opcode ] = convertedBlock . info . func ; if ( blockInfo . blockType === BlockType . HAT ) { this . _hats [ opcode ] = { edgeActivated : true } ; } } this . emit ( Runtime . EXTENSION_ADDED , categoryInfo . blocks . concat ( categoryInfo . menus ) ) ; }
Register the primitives provided by an extension.
Register the primitives provided by an extension .
/** @TODO let extension specify this */