aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-23 21:28:50 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-23 21:53:02 +0900
commit1afbde6e199309703f07f2d031632d9d2422a3d5 (patch)
tree49e9b95f5069ee31c6fc8a10809afc566e455868 /src/content
parenteec79730606ab3b49529d8063c6646d6309d8084 (diff)
support history navigation
Diffstat (limited to 'src/content')
-rw-r--r--src/content/histories.js8
-rw-r--r--src/content/index.js9
2 files changed, 16 insertions, 1 deletions
diff --git a/src/content/histories.js b/src/content/histories.js
new file mode 100644
index 0000000..2e34dc6
--- /dev/null
+++ b/src/content/histories.js
@@ -0,0 +1,8 @@
+const prev = (win) => {
+ win.history.back()
+};
+const next = (win) => {
+ win.history.forward()
+};
+
+export { prev, next };
diff --git a/src/content/index.js b/src/content/index.js
index 78389fd..2bbe39c 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -1,7 +1,8 @@
import * as scrolls from './scrolls';
+import * as histories from './histories';
+import * as actions from '../shared/actions';
import FooterLine from './footer-line';
import Follow from './follow';
-import * as actions from '../shared/actions';
var footer = null;
@@ -56,6 +57,12 @@ const invokeEvent = (action) => {
case actions.FOLLOW_START:
new Follow(window.document, action[1] || false);
break;
+ case actions.HISTORY_PREV:
+ histories.prev(window);
+ break;
+ case actions.HISTORY_NEXT:
+ histories.next(window);
+ break;
}
}