mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-13 14:00:52 -04:00
Change event names to be more descriptive. Fix some typos.
This commit is contained in:
parent
6f9a4864e9
commit
7831256044
5 changed files with 21 additions and 14899 deletions
14878
package-lock.json
generated
14878
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -575,6 +575,15 @@ class Runtime extends EventEmitter {
|
|||
return 'PERIPHERAL_CONNECTED';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event name for reporting that a peripheral has been intentionally disconnected.
|
||||
* This causes the status button in the blocks menu to indicate 'disconnected'.
|
||||
* @const {string}
|
||||
*/
|
||||
static get PERIPHERAL_DISCONNECTED () {
|
||||
return 'PERIPHERAL_DISCONNECTED';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event name for reporting that a peripheral has encountered a request error.
|
||||
* This causes the peripheral connection modal to switch to an error state.
|
||||
|
@ -585,21 +594,12 @@ class Runtime extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Event name for reporting that a peripheral has been intentionally disconnected.
|
||||
* This causes the status button in the blocks menu to indicate 'disconnected'.
|
||||
* @const {string}
|
||||
*/
|
||||
static get PERIPHERAL_DISCONNECT () {
|
||||
return 'PERIPHERAL_DISCONNECT';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event name for reporting that a peripheral has encountered a disconnect error.
|
||||
* Event name for reporting that a peripheral connection has been lost.
|
||||
* This causes a 'peripheral connection lost' error alert to display.
|
||||
* @const {string}
|
||||
*/
|
||||
static get PERIPHERAL_DISCONNECT_ERROR () {
|
||||
return 'PERIPHERAL_DISCONNECT_ERROR';
|
||||
static get PERIPHERAL_CONNECTION_LOST_ERROR () {
|
||||
return 'PERIPHERAL_CONNECTION_LOST_ERROR';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ class BLE extends JSONRPCWebSocket {
|
|||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECT);
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,7 +209,7 @@ class BLE extends JSONRPCWebSocket {
|
|||
this.disconnect();
|
||||
}
|
||||
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECT_ERROR, {
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR, {
|
||||
message: `Scratch lost connection to`,
|
||||
extensionId: this._extensionId
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ class BT extends JSONRPCWebSocket {
|
|||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECT);
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ class BT extends JSONRPCWebSocket {
|
|||
sendMessage (options) {
|
||||
return this.sendRemoteRequest('send', options)
|
||||
.catch(e => {
|
||||
this._handleDisconnectError(e);
|
||||
this.handleDisconnectError(e);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class BT extends JSONRPCWebSocket {
|
|||
this.disconnect();
|
||||
}
|
||||
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECT_ERROR, {
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR, {
|
||||
message: `Scratch lost connection to`,
|
||||
extensionId: this._extensionId
|
||||
});
|
||||
|
|
|
@ -124,11 +124,11 @@ class VirtualMachine extends EventEmitter {
|
|||
this.runtime.on(Runtime.PERIPHERAL_REQUEST_ERROR, () =>
|
||||
this.emit(Runtime.PERIPHERAL_REQUEST_ERROR)
|
||||
);
|
||||
this.runtime.on(Runtime.PERIPHERAL_DISCONNECT, () =>
|
||||
this.emit(Runtime.PERIPHERAL_DISCONNECT)
|
||||
this.runtime.on(Runtime.PERIPHERAL_DISCONNECTED, () =>
|
||||
this.emit(Runtime.PERIPHERAL_DISCONNECTED)
|
||||
);
|
||||
this.runtime.on(Runtime.PERIPHERAL_DISCONNECT_ERROR, data =>
|
||||
this.emit(Runtime.PERIPHERAL_DISCONNECT_ERROR, data)
|
||||
this.runtime.on(Runtime.PERIPHERAL_CONNECTION_LOST_ERROR, data =>
|
||||
this.emit(Runtime.PERIPHERAL_CONNECTION_LOST_ERROR, data)
|
||||
);
|
||||
this.runtime.on(Runtime.PERIPHERAL_SCAN_TIMEOUT, () =>
|
||||
this.emit(Runtime.PERIPHERAL_SCAN_TIMEOUT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue