mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Merge pull request #841 from sjhuang26/issue-795-clear-answer
Clear answer on green flag
This commit is contained in:
commit
aa306e1f29
2 changed files with 15 additions and 0 deletions
|
@ -21,6 +21,7 @@ class Scratch3SensingBlocks {
|
||||||
this._questionList = [];
|
this._questionList = [];
|
||||||
|
|
||||||
this.runtime.on('ANSWER', this._onAnswer.bind(this));
|
this.runtime.on('ANSWER', this._onAnswer.bind(this));
|
||||||
|
this.runtime.on('PROJECT_START', this._resetAnswer.bind(this));
|
||||||
this.runtime.on('PROJECT_STOP_ALL', this._clearAllQuestions.bind(this));
|
this.runtime.on('PROJECT_STOP_ALL', this._clearAllQuestions.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +74,10 @@ class Scratch3SensingBlocks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_resetAnswer () {
|
||||||
|
this._answer = '';
|
||||||
|
}
|
||||||
|
|
||||||
_enqueueAsk (question, resolve, target, wasVisible, wasStage) {
|
_enqueueAsk (question, resolve, target, wasVisible, wasStage) {
|
||||||
this._questionList.push([question, resolve, target, wasVisible, wasStage]);
|
this._questionList.push([question, resolve, target, wasVisible, wasStage]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,6 +317,15 @@ class Runtime extends EventEmitter {
|
||||||
return 'BLOCK_GLOW_OFF';
|
return 'BLOCK_GLOW_OFF';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event name when the project is started (threads may not necessarily be
|
||||||
|
* running).
|
||||||
|
* @const {string}
|
||||||
|
*/
|
||||||
|
static get PROJECT_START () {
|
||||||
|
return 'PROJECT_START';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event name when threads start running.
|
* Event name when threads start running.
|
||||||
* Used by the UI to indicate running status.
|
* Used by the UI to indicate running status.
|
||||||
|
@ -1057,6 +1066,7 @@ class Runtime extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
greenFlag () {
|
greenFlag () {
|
||||||
this.stopAll();
|
this.stopAll();
|
||||||
|
this.emit(Runtime.PROJECT_START);
|
||||||
this.ioDevices.clock.resetProjectTimer();
|
this.ioDevices.clock.resetProjectTimer();
|
||||||
this.clearEdgeActivatedValues();
|
this.clearEdgeActivatedValues();
|
||||||
// Inform all targets of the green flag.
|
// Inform all targets of the green flag.
|
||||||
|
|
Loading…
Reference in a new issue