make top-content component and frame-content component

This commit is contained in:
Shin'ya Ueoka 2017-10-15 09:02:09 +09:00
parent 042aa94936
commit 4c9d0433a6
13 changed files with 102 additions and 76 deletions

View file

@ -0,0 +1,28 @@
import CommonComponent from './common';
import * as consoleFrames from '../console-frames';
import messages from 'shared/messages';
export default class TopContent {
constructor(win, store) {
this.win = win;
this.children = [new CommonComponent(win, store)];
// TODO make component
consoleFrames.initialize(window.document);
}
update() {
this.children.forEach(c => c.update());
}
onMessage(message) {
switch (message.type) {
case messages.CONSOLE_HIDE_COMMAND:
this.win.focus();
consoleFrames.blur(window.document);
return Promise.resolve();
}
this.children.forEach(c => c.onMessage(message));
}
}