Implement stub for number and add blocks

This commit is contained in:
Tim Mickel 2016-06-09 14:29:07 -04:00
parent a987d9d9cc
commit b0441e2ef5
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,29 @@
function Scratch3OperatorsBlocks(runtime) {
/**
* The runtime instantiating this block package.
* @type {Runtime}
*/
this.runtime = runtime;
}
/**
* Retrieve the block primitives implemented by this package.
* @return {Object.<string, Function>} Mapping of opcode to Function.
*/
Scratch3OperatorsBlocks.prototype.getPrimitives = function() {
return {
'math_number': this.number,
'math_add': this.add
};
};
Scratch3OperatorsBlocks.prototype.number = function(args) {
return Number(args.NUM);
};
Scratch3OperatorsBlocks.prototype.add = function(args) {
return args.NUM1 + args.NUM2;
};
module.exports = Scratch3OperatorsBlocks;

View file

@ -6,6 +6,7 @@ var util = require('util');
var defaultBlockPackages = {
'scratch3_control': require('../blocks/scratch3_control'),
'scratch3_event': require('../blocks/scratch3_event'),
'scratch3_operators': require('../blocks/scratch3_operators'),
'wedo2': require('../blocks/wedo2')
};