import { BaseItem } from './base-item'; export class MenuItem extends BaseItem { constructor(id, title) { super(id, title); } getDOMNode() { const container = document.createElement('div'); const button = document.createElement('button'); button.textContent = this.title; button.addEventListener('click', this.handleClick.bind(this)); button.addEventListener('focus', this.onFocus.bind(this)); container.appendChild(button); this.container = container; this.button = button; return container; } getContents() { return this.id; } handleClick(event) { this.emit('choose', this.id); } focus() { this.button && this.button.focus(); } click() { this.button.click(); } }