class Editable < T > { private hook : ( v : T ) => void ; private value : T ; public readonly name : string ; constructor ( name , initialValue ) { this . name = name ; this . value = initialValue ; this . hook = ( v ) => { } ; } public getValue ( ) { return this . value ; } public setValue ( v , useHook = true ) { this . value = v ; if ( useHook ) { this . hook ( this . value ) ; } } public setModelHook ( hook ) { this . hook = hook ; this . hook ( this . value ) ; } public removeAllEventListeners ( ) { return ; } public addEventListener ( ) { return ; } } export class EditableString extends Editable < string > { public setText ( text ) { return this . setValue ( text ) ; } public getText ( ) { return this . getValue ( ) ; } } export class EditableMap < T > extends Editable < { [ k ] : T ; } > { public set ( key , value ) { return this . setValue ( { ... this . getValue ( ) , [ key ] : value } ) ; } public get ( key ) { return this . getValue ( ) [ key ] ; } public isEmpty ( ) { return Object . keys ( this . getValue ( ) ) . length === 0 ; } } export class EditableModel { constructor ( editables ) { } public onSetValue ( k , v ) { return ; } public beginCompoundOperation ( s , b ) { return ; } public endCompoundOperation ( ) { return ; } }