Remove update propagation

This commit is contained in:
Shin'ya Ueoka 2017-10-28 14:10:46 +09:00
parent c4996ef5d8
commit 24c7369451
12 changed files with 23 additions and 57 deletions

View file

@ -39,9 +39,6 @@ export default class Follow {
messages.onMessage(this.onMessage.bind(this));
}
update() {
}
key(key) {
if (Object.keys(this.hints).length === 0) {
return false;

View file

@ -14,21 +14,12 @@ export default class Common {
input.onKey(key => keymapper.key(key));
this.store = store;
this.children = [
follow,
input,
keymapper,
];
this.reloadSettings();
messages.onMessage(this.onMessage.bind(this));
}
update() {
this.children.forEach(c => c.update());
}
onMessage(message) {
switch (message.type) {
case messages.SETTINGS_CHANGED:

View file

@ -28,9 +28,6 @@ export default class InputComponent {
target.addEventListener('keyup', this.onKeyUp.bind(this));
}
update() {
}
onKey(cb) {
this.onKeyListeners.push(cb);
}

View file

@ -7,9 +7,6 @@ export default class KeymapperComponent {
this.store = store;
}
update() {
}
key(key) {
this.store.dispatch(inputActions.keyPress(key));

View file

@ -1,16 +1,3 @@
import CommonComponent from './common';
export default class FrameContent {
constructor(win, store) {
this.children = [new CommonComponent(win, store)];
}
update() {
this.children.forEach(c => c.update());
}
onMessage(message, sender) {
this.children.forEach(c => c.onMessage(message, sender));
}
}
export default CommonComponent;

View file

@ -19,6 +19,10 @@ export default class FollowController {
this.producer = null;
messages.onMessage(this.onMessage.bind(this));
store.subscribe(() => {
this.update();
});
}
onMessage(message, sender) {

View file

@ -9,13 +9,12 @@ export default class TopContent {
constructor(win, store) {
this.win = win;
this.children = [
new CommonComponent(win, store),
new FollowController(win, store),
];
this.store = store;
this.prevBlacklist = undefined;
new CommonComponent(win, store); // eslint-disable-line no-new
new FollowController(win, store); // eslint-disable-line no-new
// TODO make component
consoleFrames.initialize(this.win.document);
@ -28,8 +27,6 @@ export default class TopContent {
this.disableIfBlack(blacklist);
this.prevBlacklist = blacklist;
}
this.children.forEach(c => c.update());
}
disableIfBlack(blacklist) {