mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Fixups from code review
- Remove WeDo 2 extension from the runtime's default block packages list - The WeDo 2.0 extension now calls its own `connect` method on startup I also renamed `EXTENSION_NAME` to `EXTENSION_ID` for consistency with the rest of the extension system.
This commit is contained in:
parent
b6727a766f
commit
7297341c51
2 changed files with 6 additions and 7 deletions
|
@ -373,9 +373,9 @@ const TiltDirection = {
|
||||||
class Scratch3WeDo2Blocks {
|
class Scratch3WeDo2Blocks {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string} - the name of this extension.
|
* @return {string} - the ID of this extension.
|
||||||
*/
|
*/
|
||||||
static get EXTENSION_NAME () {
|
static get EXTENSION_ID () {
|
||||||
return 'wedo2';
|
return 'wedo2';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ class Scratch3WeDo2Blocks {
|
||||||
*/
|
*/
|
||||||
this.runtime = runtime;
|
this.runtime = runtime;
|
||||||
|
|
||||||
this.runtime.HACK_WeDo2Blocks = this;
|
this.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,7 +405,7 @@ class Scratch3WeDo2Blocks {
|
||||||
*/
|
*/
|
||||||
getInfo () {
|
getInfo () {
|
||||||
return {
|
return {
|
||||||
id: 'wedo2',
|
id: Scratch3WeDo2Blocks.EXTENSION_ID,
|
||||||
name: 'WeDo 2.0',
|
name: 'WeDo 2.0',
|
||||||
blocks: [
|
blocks: [
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ class Scratch3WeDo2Blocks {
|
||||||
}
|
}
|
||||||
const deviceManager = this.runtime.ioDevices.deviceManager;
|
const deviceManager = this.runtime.ioDevices.deviceManager;
|
||||||
const finder = this._finder =
|
const finder = this._finder =
|
||||||
deviceManager.searchAndConnect(Scratch3WeDo2Blocks.EXTENSION_NAME, WeDo2.DEVICE_TYPE);
|
deviceManager.searchAndConnect(Scratch3WeDo2Blocks.EXTENSION_ID, WeDo2.DEVICE_TYPE);
|
||||||
this._finder.promise.then(
|
this._finder.promise.then(
|
||||||
socket => {
|
socket => {
|
||||||
if (this._finder === finder) {
|
if (this._finder === finder) {
|
||||||
|
|
|
@ -23,8 +23,7 @@ const defaultBlockPackages = {
|
||||||
scratch3_sound: require('../blocks/scratch3_sound'),
|
scratch3_sound: require('../blocks/scratch3_sound'),
|
||||||
scratch3_sensing: require('../blocks/scratch3_sensing'),
|
scratch3_sensing: require('../blocks/scratch3_sensing'),
|
||||||
scratch3_data: require('../blocks/scratch3_data'),
|
scratch3_data: require('../blocks/scratch3_data'),
|
||||||
scratch3_procedures: require('../blocks/scratch3_procedures'),
|
scratch3_procedures: require('../blocks/scratch3_procedures')
|
||||||
scratch3_wedo2: require('../blocks/scratch3_wedo2')
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue