hardlounge/client/js/socket-events/more.js

23 lines
488 B
JavaScript
Raw Normal View History

2017-05-18 20:08:54 +00:00
"use strict";
import Vue from "vue";
2017-05-18 20:08:54 +00:00
const socket = require("../socket");
const store = require("../store").default;
2017-05-18 20:08:54 +00:00
socket.on("more", function(data) {
const channel = store.getters.findChannel(data.chan);
if (!channel) {
return;
2017-05-18 20:08:54 +00:00
}
channel.channel.moreHistoryAvailable =
data.totalMessages > channel.channel.messages.length + data.messages.length;
channel.channel.messages.unshift(...data.messages);
2018-07-12 16:25:41 +00:00
Vue.nextTick(() => {
2018-07-12 16:25:41 +00:00
channel.channel.historyLoading = false;
});
2017-05-18 20:08:54 +00:00
});