-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval4.js
40 lines (37 loc) · 848 Bytes
/
eval4.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: 'evaluate',
text: 'eval [JAVASCRIPT]',
blockType: BlockType.COMMAND,
arguments: {
JAVASCRIPT: {
type: ArgumentType.STRING,
defaultValue: "console.log('Hello!')"
},
},
},
],
};
}
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);