mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
make it possible for VM to emit update monitors action
This commit is contained in:
parent
26a5098347
commit
35a208d1d3
2 changed files with 19 additions and 0 deletions
|
@ -233,6 +233,14 @@ class Runtime extends EventEmitter {
|
|||
return 'SPRITE_INFO_REPORT';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event name for monitors update.
|
||||
* @const {string}
|
||||
*/
|
||||
static get MONITORS_UPDATE () {
|
||||
return 'MONITORS_UPDATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* How rapidly we try to step threads by default, in ms.
|
||||
*/
|
||||
|
@ -819,6 +827,14 @@ class Runtime extends EventEmitter {
|
|||
this.emit(Runtime.SPRITE_INFO_REPORT, target.toJSON());
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a monitor update.
|
||||
* @param {!Array} monitors Array of all monitors
|
||||
*/
|
||||
monitorsUpdate (monitors) {
|
||||
this.emit(Runtime.MONITORS_UPDATE, monitors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a target by its id.
|
||||
* @param {string} targetId Id of target to find.
|
||||
|
|
|
@ -55,6 +55,9 @@ class VirtualMachine extends EventEmitter {
|
|||
instance.runtime.on(Runtime.SPRITE_INFO_REPORT, spriteInfo => {
|
||||
instance.emit(Runtime.SPRITE_INFO_REPORT, spriteInfo);
|
||||
});
|
||||
instance.runtime.on(Runtime.MONITORS_UPDATE, spriteInfo => {
|
||||
instance.emit(Runtime.MONITORS_UPDATE, spriteInfo);
|
||||
});
|
||||
|
||||
this.blockListener = this.blockListener.bind(this);
|
||||
this.flyoutBlockListener = this.flyoutBlockListener.bind(this);
|
||||
|
|
Loading…
Reference in a new issue