From e021504356016dc4cdb89356cae542c31486fe6a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Thu, 9 Nov 2017 21:05:02 +0900 Subject: first find implementation --- src/content/components/top-content/find.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/content/components/top-content/find.js (limited to 'src/content/components/top-content/find.js') 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)); + } + } +} -- cgit v1.2.3