Skip to content

Commit

Permalink
watch event changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Leung committed Sep 4, 2024
1 parent aa6b45d commit f312c24
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/Scrubber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
<script setup>
import { Timeline } from "vis-timeline";
import { DataSet } from "vis-data";
import { onMounted, ref, defineProps } from 'vue';
import { onMounted, ref, watch } from 'vue';
import { useEventStore } from '../stores/event_store';
const props = defineProps(['events']);
// Get events from the event store
const store = useEventStore();
onMounted(() => {
function renderScrubber() {
// DOM element where the Timeline will be attached
const container = document.getElementById('visualization');
// Get events from the event store
const store = useEventStore();
const events = store.events;
// Create a DataSet for the timeline items
Expand All @@ -41,7 +39,11 @@ onMounted(() => {
// Create and render the Timeline
new Timeline(container, items, options);
})
}
watch(() => store.events, (newDict) => {
renderScrubber()
});
</script>

<style type="text/css">
Expand Down

0 comments on commit f312c24

Please sign in to comment.