提议者:
提议类型: 功能
涉及文件: structs.tstools.ts
(opens new window) FurryR
处理者:
(opens new window) FallingShrimp
提议主题:
使用TS的装饰器特性定义拓展积木提议类型: 功能
涉及文件: structs.tstools.ts
如题,使用装饰器特性,打在拓展的类方法上,实现拓展积木的自动注册。
import { BlockTypes } from "@framework/structs";
1
export default class MyExtension extends Extension {
@BlockTypes.Command("alert [sth=Hello] to window with suffix [suffix:number=114514]")
alertToWindow(arg: { sth: string, suffix: number}) {
alert(arg.sth);
}
}
1
2
3
4
5
6
2
3
4
5
6
⚠️ <ScratchBlock>组件正在实验中,可能存在一些问题。
alert [sth=Hello] to window with suffix [suffix:number=114514]
alert [sth=Hello] to window with suffix [suffix:number=114514]