-
Notifications
You must be signed in to change notification settings - Fork 58
/
index.vue
74 lines (69 loc) · 2.14 KB
/
index.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
<section>
<template v-if="currentWikiRevId">
<RevisionCard
:wikiRevId="currentWikiRevId"
:key="currentWikiRevId"
:diffProp="currentDiff"
:oresProp="currentOres"
:interactionProp="currentInteraction"
:revisionProp="currentRevision"
v-on:next-card="showNext()"
></RevisionCard>
</template>
</section>
</template>
<script>
import RevisionCard from '~/components/RevisionCard.vue';
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default {
components: {
RevisionCard
},
data() {
return {
title: 'WikiLoop Battlefield',
currentWikiRevId: null
}
},
computed: {
currentDiff: {
get () {
return this.$store.state.revisions.wikiRevIdToMeta[this.currentWikiRevId].diff;
}
},
currentRevision: {
get () {
return this.$store.state.revisions.wikiRevIdToMeta[this.currentWikiRevId];
}
},
currentInteraction: {
get () {
return this.$store.state.revisions.wikiRevIdToMeta[this.currentWikiRevId].interaction;
}
},
currentOres: {
get () {
let ores = this.$store.state.revisions.wikiRevIdToMeta[this.currentWikiRevId].ores;
return ores;
}
},
},
methods: {
showNext: async function() {
this.currentWikiRevId = this.$store.state.revisions.nextWikiRevIdsHeap.peek();
this.$store.commit(`revisions/pop`);
await this.$store.dispatch(`revisions/loadMoreWikiRevs`);
/*unawait*/ this.$store.dispatch(`revisions/preloadAsyncMeta`).then();
}
},
async mounted() {
await this.$store.dispatch(`revisions/loadMoreWikiRevs`);
this.showNext();
}
}
</script>
<style>
</style>