2020-06-28 17:02:46 +02:00

24 lines
636 B
TypeScript

/*
* Copyright (C) SapphireCode - All Rights Reserved
* This file is part of Snippeteer which is released under BSD-3-Clause.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, June 2020
*/
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;
}
}