diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-06 21:42:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-09 16:51:19 +0900 |
commit | e15de17598b222f16c2eb9c4aa2e47610bc61ed9 (patch) | |
tree | 8684c3570cdfa292fc0c2831dddf9e9f77f16688 /src/content | |
parent | eff7fe276b5a9d50037c7d965712dc24d226a984 (diff) |
use action as object
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/index.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/content/index.js b/src/content/index.js index fdc7e89..27dc581 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -8,16 +8,12 @@ import Follow from './follow'; let vvConsole = new ConsoleFrame(window); const doAction = (action) => { - if (typeof action === 'undefined' || action === null) { - return; - } - - switch (action[0]) { + switch (action.type) { case actions.CMD_OPEN: vvConsole.showCommand(''); break; case actions.CMD_TABS_OPEN: - if (action[1] || false) { + if (action.alter) { // alter url vvConsole.showCommand('open ' + window.location.href); } else { @@ -28,10 +24,10 @@ const doAction = (action) => { vvConsole.showCommand('buffer '); break; case actions.SCROLL_LINES: - scrolls.scrollLines(window, action[1]); + scrolls.scrollLines(window, action.count); break; case actions.SCROLL_PAGES: - scrolls.scrollPages(window, action[1]); + scrolls.scrollPages(window, action.count); break; case actions.SCROLL_TOP: scrolls.scrollTop(window); @@ -46,7 +42,7 @@ const doAction = (action) => { scrolls.scrollRight(window); break; case actions.FOLLOW_START: - new Follow(window.document, action[1] || false); + new Follow(window.document, action.newTab); break; case actions.HISTORY_PREV: histories.prev(window); |