Improve warp

This commit is contained in:
syuilo
2019-04-18 22:00:11 +09:00
parent 8aaab195c6
commit fda8cf77ed
7 changed files with 47 additions and 7 deletions

View File

@@ -18,10 +18,12 @@ export default Vue.extend({
data() {
return {
connection: null,
date: null,
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
listId: this.list.id,
limit: fetchLimit + 1,
untilId: cursor ? cursor : undefined,
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
@@ -46,6 +48,10 @@ export default Vue.extend({
},
mounted() {
this.init();
this.$root.$on('warp', this.warp);
this.$once('hook:beforeDestroy', () => {
this.$root.$off('warp', this.warp);
});
},
beforeDestroy() {
this.connection.dispose();
@@ -68,6 +74,10 @@ export default Vue.extend({
},
onUserRemoved() {
(this.$refs.timeline as any).reload();
},
warp(date) {
this.date = date;
(this.$refs.timeline as any).reload();
}
}
});