mirror of
https://github.com/He4eT/tabswiper.git
synced 2026-05-05 00:57:23 +00:00
popup/tabswiper: extract click handlers
This commit is contained in:
parent
5ac43772ab
commit
3257dc3cab
1 changed files with 16 additions and 0 deletions
16
popup/tabswiper/modules/clickHandlers.js
Normal file
16
popup/tabswiper/modules/clickHandlers.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export const attachClickHandlers = (store) => {
|
||||
const controls = [
|
||||
['currentTab', store.actions.goToTab],
|
||||
['buttonClose', store.actions.closeTab],
|
||||
['buttonShow', store.actions.goToTab],
|
||||
['buttonSkip', store.actions.keepTab],
|
||||
]
|
||||
|
||||
controls.forEach(([elementId, handler]) => {
|
||||
document.getElementById(elementId).addEventListener('click', (e) => {
|
||||
e.preventDefault()
|
||||
handler(store.getCurrentState().currentTab)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue