aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/App.vue16
-rw-r--r--src/components/InfoModal.vue2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/App.vue b/src/App.vue
index 96baefd..4a8c3d9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -82,7 +82,7 @@ import SettingsIcon from './components/icon/SettingsIcon.vue';
import PlusIcon from './components/icon/PlusIcon.vue';
import SearchIcon from './components/icon/SearchIcon.vue';
-import {makeThrottled, makeThrottledSpaced} from './util';
+import {makeThrottledSpaced} from './util';
import {
HistDate, HistEvent, EventInfo, cmpHistEvent,
queryServer, EventResponseJson, jsonToHistEvent, EventInfoJson, jsonToEventInfo,
@@ -359,7 +359,19 @@ async function handleOnEventDisplay(
}
}
-const onEventDisplay = makeThrottled(handleOnEventDisplay, 200);
+const timelineTimeouts: Map<number, number> = new Map();
+ // Maps timeline IDs to setTimeout() timeouts (used to throttle handleEventDisplay() per-timeline)
+
+function onEventDisplay(
+ timelineId: number, eventIds: number[], firstDate: HistDate, lastDate: HistDate, scaleIdx: number){
+ if (timelineTimeouts.has(timelineId)){
+ clearTimeout(timelineTimeouts.get(timelineId));
+ }
+ timelineTimeouts.set(timelineId, window.setTimeout(async () => {
+ timelineTimeouts.delete(timelineId);
+ handleOnEventDisplay(timelineId, eventIds, firstDate, lastDate, scaleIdx);
+ }, 200));
+}
// ========== For info modal ==========
diff --git a/src/components/InfoModal.vue b/src/components/InfoModal.vue
index 795b21c..237934d 100644
--- a/src/components/InfoModal.vue
+++ b/src/components/InfoModal.vue
@@ -82,7 +82,7 @@
<div v-if="eventInfo.desc != null">{{eventInfo.desc}}</div>
<div v-else class="text-center text-stone-500 text-sm">(No description found)</div>
<div v-if="event.id > 0" class="text-sm text-right">
- <a :href="'https://en.wikipedia.org/?curid=' + eventInfo.wikiId" target="_blank">From Wikipedia</a>
+ From <a :href="'https://en.wikipedia.org/?curid=' + eventInfo.wikiId" target="_blank">Wikipedia</a>
(via <a :href="'https://www.wikidata.org/wiki/Q' + event.id" target="_blank">Wikidata</a>)
<external-link-icon class="inline-block w-3 h-3 ml-1"/>
</div>