blockly > Extensions > registerMutator
Extensions.registerMutator() 函式
註冊新的擴充功能函式,以便將變動器新增至區塊。這會在暫存器上執行一些基本的完整性檢查。如果混合型同時定義了組合和分解,包裝函式可能也會在區塊中新增變異器對話方塊。
Signature:
export declare function registerMutator(name: string, mixinObj: any, opt_helperFn?: () => any, opt_blockList?: string[]): void;
參數
參數 | 類型 | 說明 |
---|---|---|
名稱 | 字串 | 此更動子擴充功能的名稱。 |
mixinObj | 不限 | 要混合的值。 |
opt_helperFn | () => 任何 | (選用) 混合物件後要套用的選用函式。 |
opt_blockList | string[] | (選用) 顯示在靜音工具對話方塊的飛行過程中的區塊清單。 |
傳回:
void
例外狀況
如果異動無效或無法套用至區塊,則為 {Error}。