Skip to content

Instantly share code, notes, and snippets.

@champierre
Last active July 14, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champierre/5dfbf9412f617a83d0b64025c03c512f to your computer and use it in GitHub Desktop.
Save champierre/5dfbf9412f617a83d0b64025c03c512f to your computer and use it in GitHub Desktop.
Scratch 3.0 Extension Test
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