UNPKG

ui-lit

Version:

UI Elements on LIT

23 lines (22 loc) 700 B
export class FocusController { constructor(host) { this.focused = false; this._onFocus = () => { this.focused = true; // this.host.requestUpdate(); }; this._onBlur = () => { this.focused = false; // this.host.requestUpdate(); }; (this.host = host).addController(this); } hostConnected() { this.host.addEventListener("focus", this._onFocus); this.host.addEventListener("blur", this._onBlur); } hostDisconnected() { this.host.removeEventListener("focus", this._onFocus); this.host.removeEventListener("blur", this._onBlur); } }