diff --git a/pages/search/modules/inputHandlers.js b/pages/search/modules/inputHandlers.js new file mode 100644 index 0000000..6927c50 --- /dev/null +++ b/pages/search/modules/inputHandlers.js @@ -0,0 +1,8 @@ +export const attachInputHandlers = (store) => { + const searchBox = document.getElementById('searchbox') + const actionbox = document.getElementById('actionbox') + + searchBox.addEventListener('input', (e) => { + store.actions.updateQuery(e.target.value) + }) +} diff --git a/pages/search/search.js b/pages/search/search.js index 49e174e..1a7cc3f 100644 --- a/pages/search/search.js +++ b/pages/search/search.js @@ -1,7 +1,10 @@ import * as Store from './modules/store.js' import * as dom from './modules/dom.js' +import * as inputHandlers from './modules/inputHandlers.js' const store = Store.init({ tabs: browser.tabs, onStateUpdate: dom.updateSearchResults, }) + +void inputHandlers.attachInputHandlers(store)