diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-09 21:05:02 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-11 16:16:01 +0900 |
commit | e021504356016dc4cdb89356cae542c31486fe6a (patch) | |
tree | 9aca1822091301cff833632011e37d2a9f87fd1b /src/content/components/top-content/find.js | |
parent | 956dd937d33d167440d9d637f67ebff5d72353e5 (diff) |
first find implementation
Diffstat (limited to 'src/content/components/top-content/find.js')
-rw-r--r-- | src/content/components/top-content/find.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/content/components/top-content/find.js b/src/content/components/top-content/find.js new file mode 100644 index 0000000..6696f00 --- /dev/null +++ b/src/content/components/top-content/find.js @@ -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)); + } + } +} |