first find implementation

This commit is contained in:
Shin'ya Ueoka 2017-11-09 21:05:02 +09:00
parent 956dd937d3
commit e021504356
8 changed files with 74 additions and 25 deletions

View file

@ -0,0 +1,23 @@
import * as findActions from 'content/actions/find';
import messages from 'shared/messages';
export default class FindComponent {
constructor(win, store) {
this.win = win;
this.store = store;
messages.onMessage(this.onMessage.bind(this));
}
onMessage(message) {
let state = this.store.getState().find;
switch (message.type) {
case messages.CONSOLE_ENTER_FIND:
return this.store.dispatch(findActions.next(message.text));
case messages.FIND_NEXT:
return this.store.dispatch(findActions.next(state.keyword));
case messages.FIND_PREV:
return this.store.dispatch(findActions.prev(state.keyword));
}
}
}