export default class ObservableMap < K , V > extends Map { #observer : Array < Function > = [ ] ; public observeChange ( block ) { this . #observer . push ( block ) ; } public set ( key , value ) { super . set ( key , value ) ; this . callObservers ( { key , value } ) ; return this ; } private callObservers ( change ) { this . #observer . forEach ( obs => { obs ( change ) ; } ) ; } }