We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1d222b commit 21e630dCopy full SHA for 21e630d
src/index.ts
@@ -40,7 +40,7 @@ examplesNode!.addEventListener(
40
const exampleKey = (<HTMLInputElement>(
41
event.target
42
)).value;
43
- render(findExample(exampleKey));
+ location.hash = exampleKey;
44
}
45
);
46
@@ -70,9 +70,19 @@ function render(example: Example) {
70
location.hash = example.key;
71
72
73
-if (location.hash) {
+function renderFromHash() {
74
const exampleKey = location.hash.slice(1);
75
+ if (exampleKey) {
76
+ render(findExample(exampleKey));
77
+ }
78
+}
79
+
80
+window.addEventListener("hashchange", () => {
81
+ renderFromHash();
82
+});
83
84
+if (location.hash) {
85
86
} else {
87
render(examples[0]);
88
0 commit comments