17 lines
401 B
TypeScript
17 lines
401 B
TypeScript
import { PatchAction } from '../classes/PatchAction';
|
|
|
|
export class ActionFactory {
|
|
private static _actions: Record<string, (json:string)=>PatchAction> = {};
|
|
|
|
public static get (name:string, json:string): PatchAction {
|
|
return this._actions[name] (json);
|
|
}
|
|
|
|
public static register (
|
|
name:string,
|
|
constr: (json:string)=>PatchAction
|
|
):void {
|
|
this._actions[name] = constr;
|
|
}
|
|
}
|