blockly > registry > getClass

registry.getClass() 函数

获取具有指定名称和类型的类。

Signature:

export declare function getClass<T>(type: string | Type<T>, name: string, opt_throwIfMissing?: boolean): (new (...p1: any[]) => T) | null;

参数

参数 类型 说明
类型 字符串 | 类型<T> 插件的类型。(例如字段、渲染程序)
name string 插件的名称。(例如:field_angle、geras)
opt_throwIfMissing boolean (可选)如果我们找不到该插件,是否要抛出错误。

返回

(new (...p1: any[]) => T) | null

具有指定名称和类型的类,如果不存在,则为 null。