import { DesignerNode } from "./designernode" ; export class DesignerNodeFactory { public name : string ; public displayName : string ; public create : ( ) => DesignerNode ; } export class DesignerLibrary { versionName : string ; nodes = [ ] ; public addNode < T extends DesignerNode > ( name , displayName , type ) { const factory = new DesignerNodeFactory ( ) ; factory . name = name ; factory . displayName = displayName ; factory . create = ( ) : DesignerNode => { return new type ( ) ; } ; this . nodes [ name ] = factory ; } getVersionName ( ) { return this . versionName ; } public create ( name ) { const node = this . nodes [ name ] . create ( ) ; node . typeName = name ; return node ; } }