mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Fix consistency of existing emits
This commit is contained in:
parent
9859c3d91a
commit
2ff719f2ba
3 changed files with 22 additions and 21 deletions
|
@ -137,10 +137,10 @@ window.onload = function() {
|
|||
};
|
||||
|
||||
// Feedback for stacks and blocks running.
|
||||
vm.on('STACK_GLOW_ON', function(data) {
|
||||
vm.on('SCRIPT_GLOW_ON', function(data) {
|
||||
workspace.glowStack(data.id, true);
|
||||
});
|
||||
vm.on('STACK_GLOW_OFF', function(data) {
|
||||
vm.on('SCRIPT_GLOW_OFF', function(data) {
|
||||
workspace.glowStack(data.id, false);
|
||||
});
|
||||
vm.on('BLOCK_GLOW_ON', function(data) {
|
||||
|
|
|
@ -159,13 +159,13 @@ Runtime.STAGE_HEIGHT = 360;
|
|||
* Event name for glowing a script.
|
||||
* @const {string}
|
||||
*/
|
||||
Runtime.SCRIPT_GLOW_ON = 'STACK_GLOW_ON';
|
||||
Runtime.SCRIPT_GLOW_ON = 'SCRIPT_GLOW_ON';
|
||||
|
||||
/**
|
||||
* Event name for unglowing a script.
|
||||
* @const {string}
|
||||
*/
|
||||
Runtime.SCRIPT_GLOW_OFF = 'STACK_GLOW_OFF';
|
||||
Runtime.SCRIPT_GLOW_OFF = 'SCRIPT_GLOW_OFF';
|
||||
|
||||
/**
|
||||
* Event name for glowing a block.
|
||||
|
@ -659,9 +659,9 @@ Runtime.prototype.quietGlow = function (scriptBlockId) {
|
|||
*/
|
||||
Runtime.prototype.glowBlock = function (blockId, isGlowing) {
|
||||
if (isGlowing) {
|
||||
this.emit(Runtime.BLOCK_GLOW_ON, blockId);
|
||||
this.emit(Runtime.BLOCK_GLOW_ON, {id: blockId});
|
||||
} else {
|
||||
this.emit(Runtime.BLOCK_GLOW_OFF, blockId);
|
||||
this.emit(Runtime.BLOCK_GLOW_OFF, {id: blockId});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -672,9 +672,9 @@ Runtime.prototype.glowBlock = function (blockId, isGlowing) {
|
|||
*/
|
||||
Runtime.prototype.glowScript = function (topBlockId, isGlowing) {
|
||||
if (isGlowing) {
|
||||
this.emit(Runtime.SCRIPT_GLOW_ON, topBlockId);
|
||||
this.emit(Runtime.SCRIPT_GLOW_ON, {id: topBlockId});
|
||||
} else {
|
||||
this.emit(Runtime.SCRIPT_GLOW_OFF, topBlockId);
|
||||
this.emit(Runtime.SCRIPT_GLOW_OFF, {id: topBlockId});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -684,7 +684,7 @@ Runtime.prototype.glowScript = function (topBlockId, isGlowing) {
|
|||
* @param {string} value Value to show associated with the block.
|
||||
*/
|
||||
Runtime.prototype.visualReport = function (blockId, value) {
|
||||
this.emit(Runtime.VISUAL_REPORT, blockId, String(value));
|
||||
this.emit(Runtime.VISUAL_REPORT, {id: blockId, value: String(value)});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
25
src/index.js
25
src/index.js
|
@ -25,23 +25,24 @@ var VirtualMachine = function () {
|
|||
*/
|
||||
instance.editingTarget = null;
|
||||
// Runtime emits are passed along as VM emits.
|
||||
instance.runtime.on(Runtime.SCRIPT_GLOW_ON, function (id) {
|
||||
instance.emit(Runtime.SCRIPT_GLOW_ON, {id: id});
|
||||
instance.runtime.on(Runtime.SCRIPT_GLOW_ON, function (glowData) {
|
||||
instance.emit(Runtime.SCRIPT_GLOW_ON, glowData);
|
||||
});
|
||||
instance.runtime.on(Runtime.SCRIPT_GLOW_OFF, function (id) {
|
||||
instance.emit(Runtime.SCRIPT_GLOW_OFF, {id: id});
|
||||
instance.runtime.on(Runtime.SCRIPT_GLOW_OFF, function (glowData) {
|
||||
instance.emit(Runtime.SCRIPT_GLOW_OFF, glowData);
|
||||
});
|
||||
instance.runtime.on(Runtime.BLOCK_GLOW_ON, function (id) {
|
||||
instance.emit(Runtime.BLOCK_GLOW_ON, {id: id});
|
||||
instance.runtime.on(Runtime.BLOCK_GLOW_ON, function (glowData) {
|
||||
instance.emit(Runtime.BLOCK_GLOW_ON, glowData);
|
||||
});
|
||||
instance.runtime.on(Runtime.BLOCK_GLOW_OFF, function (id) {
|
||||
instance.emit(Runtime.BLOCK_GLOW_OFF, {id: id});
|
||||
instance.runtime.on(Runtime.BLOCK_GLOW_OFF, function (glowData) {
|
||||
instance.emit(Runtime.BLOCK_GLOW_OFF, glowData);
|
||||
});
|
||||
instance.runtime.on(Runtime.VISUAL_REPORT, function (id, value) {
|
||||
instance.emit(Runtime.VISUAL_REPORT, {id: id, value: value});
|
||||
});
|
||||
instance.runtime.on(Runtime.SPRITE_INFO_REPORT, function (data) {
|
||||
instance.emit(Runtime.SPRITE_INFO_REPORT, data);
|
||||
instance.runtime.on(Runtime.VISUAL_REPORT, function (visualReport) {
|
||||
instance.emit(Runtime.VISUAL_REPORT, visualReport);
|
||||
});
|
||||
instance.runtime.on(Runtime.SPRITE_INFO_REPORT, function (spriteInfo) {
|
||||
instance.emit(Runtime.SPRITE_INFO_REPORT, spriteInfo);
|
||||
});
|
||||
|
||||
this.blockListener = this.blockListener.bind(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue