export interface IOptions { [ key ] : any ; } export default class Registry { public registry : WeakMap < HTMLElement | Window , IOptions > ; constructor ( ) { this . registry = new WeakMap ( ) ; } public elementExists ( elem ) { return this . registry . has ( elem ) ; } public getElement ( elem ) { return this . registry . get ( elem ) ; } method param { HTMLElement | Window } element param { IOption } options param { IOption . root } root param { IOption . watcher } observer public public addElement ( element , options ? ) { if ( ! element ) { return ; } this . registry . set ( element , options || { } ) ; } method param { HTMLElement | Window } target public public removeElement ( target ) { this . registry . delete ( target ) ; } method public public destroyRegistry ( ) { this . registry = new WeakMap ( ) ; } }