Implement stub for number and add blocks
This commit is contained in:
1 parent
a987d9d9cc
commit
b0441e2ef5
2 files changed
+30
No files matched your search
@@ -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;
|
||||
@@ -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')
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user