-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval2.js
40 lines (37 loc) · 799 Bytes
/
eval2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function (Scratch) {
'use strict';
console.log("Eval for Valuminous");
class Eval {
getInfo() {
return {
id: 'Eval',
name: 'Evaluate',
color1: '#ff6d00',
blocks: [
{
opcode: 'eval',
blockType: Scratch.BlockType.COMMAND,
text: 'Eval [JAVASCRIPT]',
arguments: {
SPRITE: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Sprite1',
},
},
},
],
};
}
eval({ JAVASCRIPT }) {
try {
// eslint-disable-next-line no-eval
eval(String(args.JAVASCRIPT));
} catch (e) {
alert(e);
console.error(e);
}
}
}
Scratch.extensions.register(new Eval());
// @ts-ignore
})(Scratch);