30 lines
674 B
JavaScript
30 lines
674 B
JavaScript
|
import * as EventEmitter from 'eventemitter3';
|
||
|
export class BaseItem extends EventEmitter {
|
||
|
constructor(id, title) {
|
||
|
super();
|
||
|
this.id = id;
|
||
|
this.title = title;
|
||
|
}
|
||
|
getDOMNode() {
|
||
|
let node = document.createTextNode(this.title);
|
||
|
let element = document.createElement('div');
|
||
|
element.appendChild(node);
|
||
|
return element;
|
||
|
}
|
||
|
getContents() {
|
||
|
return;
|
||
|
}
|
||
|
onFocus(event) {
|
||
|
this.emit('focus', this.id);
|
||
|
}
|
||
|
focus() {
|
||
|
this.container && this.container.focus();
|
||
|
}
|
||
|
click() {
|
||
|
return;
|
||
|
}
|
||
|
getID() {
|
||
|
return this.id;
|
||
|
}
|
||
|
}
|