interface ImageHashMap { [ key ] : HTMLImageElement ; } const ImageUtils = { MAX_LEVEL : 4 , images : < ImageHashMap > { } , add ( url , img ) { this . images [ url ] = img ; } , get ( url ) { return this . images [ url ] ; } , remove ( url ) { delete this . images [ url ] ; } , clear ( ) { this . images = { } ; } , getCount ( ) { var count = 0 ; for ( var url in this . images ) { if ( this . images . hasOwnProperty ( url ) ) { count ++ ; } } return count ; } } ; export default ImageUtils ;