Refactor & Clean up

This commit is contained in:
syuilo
2018-11-09 08:13:34 +09:00
parent ba845f5218
commit 60ef3e3563
154 changed files with 438 additions and 481 deletions

View File

@@ -57,13 +57,13 @@ export default Vue.extend({
mounted() {
window.addEventListener('scroll', this.onScroll, { passive: true });
this.connection = (this as any).os.stream.useSharedConnection('main');
this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('notification', this.onNotification);
const max = 10;
(this as any).api('i/notifications', {
this.$root.api('i/notifications', {
limit: max + 1
}).then(notifications => {
if (notifications.length == max + 1) {
@@ -90,7 +90,7 @@ export default Vue.extend({
const max = 30;
(this as any).api('i/notifications', {
this.$root.api('i/notifications', {
limit: max + 1,
untilId: this.notifications[this.notifications.length - 1].id
}).then(notifications => {
@@ -107,7 +107,7 @@ export default Vue.extend({
onNotification(notification) {
// TODO: ユーザーが画面を見てないと思われるとき(ブラウザやタブがアクティブじゃないなど)は送信しない
(this as any).os.stream.send('readNotification', {
this.$root.stream.send('readNotification', {
id: notification.id
});