src/virtual-machine.js
/**
     * Install `deserialize` results: zero or more targets after the extensions (if any) used by those targets.
     * @param {Array.<Target>} targets - the targets to be installed
     * @param {ImportedExtensionsInfo} extensions - metadata about extensions used by these targets
     * @param {boolean} wholeProject - set to true if installing a whole project, as opposed to a single sprite.
     * @returns {Promise} resolved once targets have been installed
     */
Install `deserialize` results: zero or more targets after the extensions (if any) used by those targets.
@param {Array.} targets - the targets to be installed
@param {ImportedExtensionsInfo} extensions - metadata about extensions used by these targets
@param {boolean} wholeProject - set to true if installing a whole project, as opposed to a single sprite.
@returns {Promise} resolved once targets have been installed
Install ` deserialize ` results : zero or more targets after the extensions ( if any ) used by those targets . @param { Array . } targets - the targets to be installed @param { ImportedExtensionsInfo } extensions - metadata about extensions used by these targets @param { boolean } wholeProject - set to true if installing a whole project as opposed to a single sprite . @returns { Promise } resolved once targets have been installed
installTargets (targets, extensions, wholeProject) {
        const extensionPromises = [];
        extensions.extensionIDs.forEach(extensionID => {
            if (!this.extensionManager.isExtensionLoaded(extensionID)) {
                const extensionURL = extensions.extensionURLs.get(extensionID) || extensionID;
                extensionPromises.push(this.extensionManager.loadExtensionURL(extensionURL));
            }
        });
        targets = targets.filter(target => !!target);
        return Promise.all(extensionPromises).then(() => {
            if (wholeProject) {
                this.clear();
            }
            targets.forEach(target => {
                this.runtime.targets.push(target);
                ( target).updateAllDrawableProperties();
                if (target.isSprite()) this.renameSprite(target.id, target.getName());
            });
            if (wholeProject && (targets.length > 1)) {
                this.editingTarget = targets[1];
            } else {
                this.editingTarget = targets[0];
            }
            this.emitTargetsUpdate();
            this.emitWorkspaceUpdate();
            this.runtime.setEditingTarget(this.editingTarget);
        });
    }
installTargets ( targets , extensions , wholeProject ) { const extensionPromises = [ ] ; extensions . extensionIDs . forEach ( extensionID => { if ( ! this . extensionManager . isExtensionLoaded ( extensionID ) ) { const extensionURL = extensions . extensionURLs . get ( extensionID ) || extensionID ; extensionPromises . push ( this . extensionManager . loadExtensionURL ( extensionURL ) ) ; } } ) ; targets = targets . filter ( target => ! ! target ) ; return Promise . all ( extensionPromises ) . then ( ( ) => { if ( wholeProject ) { this . clear ( ) ; } targets . forEach ( target => { this . runtime . targets . push ( target ) ; ( target ) . updateAllDrawableProperties ( ) ; if ( target . isSprite ( ) ) this . renameSprite ( target . id , target . getName ( ) ) ; } ) ; if ( wholeProject && ( targets . length > 1 ) ) { this . editingTarget = targets [ 1 ] ; } else { this . editingTarget = targets [ 0 ] ; } this . emitTargetsUpdate ( ) ; this . emitWorkspaceUpdate ( ) ; this . runtime . setEditingTarget ( this . editingTarget ) ; } ) ; }
Install `deserialize` results: zero or more targets after the extensions (if any) used by those targets.
Install ` deserialize ` results : zero or more targets after the extensions ( if any ) used by those targets .
/** @type RenderedTarget */ // Ensure unique sprite name // Select the first target for editing, e.g., the first sprite. // Update the VM user's knowledge of targets and blocks on the workspace.