import { ElementType } from "./ElementType"; import { MouseEventCallback, OnClick } from "./EventListeners"; export class DomElementConstructorType { type:ElementType; } export class DOMElement { _element:T; get element(){ return this._element; } constructor( e:T ) { this._element = e; } get( constructorType:DomElementConstructorType ) { let element = constructorType.type.query( this._element ); return new ( constructorType as any )( element ); } getAll( constructorType:DomElementConstructorType ) { let elements = constructorType.type.queryAll( this._element ); return elements.map( e => new ( constructorType as any )( e ) ); } onClick( action:MouseEventCallback, options?: any ) { OnClick.add( this.element as any as HTMLElement, action, options ); } }