node_modules/scratch-vm/src/virtual-machine.js
/**
     * Duplicate a sprite.
     * @param {string} targetId ID of a target whose sprite to duplicate.
     * @returns {Promise} Promise that resolves when duplicated target has
     *     been added to the runtime.
     */
Duplicate a sprite.
@param {string} targetId ID of a target whose sprite to duplicate.
@returns {Promise} Promise that resolves when duplicated target has
been added to the runtime.
Duplicate a sprite . @param { string } targetId ID of a target whose sprite to duplicate . @returns { Promise } Promise that resolves when duplicated target has been added to the runtime .
duplicateSprite (targetId) {
        const target = this.runtime.getTargetById(targetId);
        if (!target) {
            throw new Error('No target with the provided id.');
        } else if (!target.isSprite()) {
            throw new Error('Cannot duplicate non-sprite targets.');
        } else if (!target.sprite) {
            throw new Error('No sprite associated with this target.');
        }
        return target.duplicate().then(newTarget => {
            this.runtime.targets.push(newTarget);
            this.setEditingTarget(newTarget.id);
        });
    }
duplicateSprite ( targetId ) { const target = this . runtime . getTargetById ( targetId ) ; if ( ! target ) { throw new Error ( 'No target with the provided id.' ) ; } else if ( ! target . isSprite ( ) ) { throw new Error ( 'Cannot duplicate non-sprite targets.' ) ; } else if ( ! target . sprite ) { throw new Error ( 'No sprite associated with this target.' ) ; } return target . duplicate ( ) . then ( newTarget => { this . runtime . targets . push ( newTarget ) ; this . setEditingTarget ( newTarget . id ) ; } ) ; }
Duplicate a sprite.
Duplicate a sprite .