mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-27 22:50:22 -04:00
Add mechanism for per-block metadata
This commit is contained in:
parent
c4138e6603
commit
4c6f08f665
2 changed files with 48 additions and 1 deletions
src/engine
|
@ -110,6 +110,22 @@ Sequencer.prototype.stepThread = function (thread) {
|
|||
instance.runtime.glowBlock(currentBlock, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* A callback for the primitive to set data on the block level.
|
||||
* @type {Function}
|
||||
*/
|
||||
var blockDataSetCallback = function (key, value) {
|
||||
instance.runtime.setBlockExecutionData(currentBlock, key, value);
|
||||
};
|
||||
|
||||
/**
|
||||
* A callback for the primitive to get data on the block level.
|
||||
* @type {Function}
|
||||
*/
|
||||
var blockDataGetCallback = function (key) {
|
||||
return instance.runtime.getBlockExecutionData(currentBlock, key);
|
||||
};
|
||||
|
||||
// @todo
|
||||
var argValues = [];
|
||||
|
||||
|
@ -128,7 +144,9 @@ Sequencer.prototype.stepThread = function (thread) {
|
|||
blockFunction(argValues, {
|
||||
yield: threadYieldCallback,
|
||||
done: threadDoneCallback,
|
||||
timeout: YieldTimers.timeout
|
||||
timeout: YieldTimers.timeout,
|
||||
setData: blockDataSetCallback,
|
||||
getData: blockDataGetCallback
|
||||
});
|
||||
}
|
||||
catch(e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue