Last active
July 14, 2018 16:23
-
-
Save champierre/5dfbf9412f617a83d0b64025c03c512f to your computer and use it in GitHub Desktop.
Scratch 3.0 Extension Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
constructor() {} | |
getInfo() { // 拡張機能の各種情報 | |
return { | |
id: 'test', | |
name: 'Test', // 拡張機能の名前 | |
blocks: [ // 各ブロックの定義 | |
{ | |
opcode: 'hello', // このブロックが実行されると、helloという関数が呼ばれる | |
blockType: Scratch.BlockType.COMMAND, // 「10歩動かす」のような通常の命令ブロック | |
text: 'hello' // ブロックに表示されるテキスト | |
} | |
] | |
} | |
} | |
hello() { | |
console.log('hello'); // console log に hello と出力 | |
} | |
} | |
Scratch.extensions.register(new Test()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment