summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-11 18:08:26 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-11 18:08:26 +0900
commitbd79352e8005bd8fe0ffa846e3318bc49b3fdd36 (patch)
tree5a6a266ae92587c654d0089d493dc57a0ac3903e /src/web/app/common
parent#1231 (diff)
downloadsharkey-bd79352e8005bd8fe0ffa846e3318bc49b3fdd36.tar.gz
sharkey-bd79352e8005bd8fe0ffa846e3318bc49b3fdd36.tar.bz2
sharkey-bd79352e8005bd8fe0ffa846e3318bc49b3fdd36.zip
#1204
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/views/components/othello.vue17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/web/app/common/views/components/othello.vue b/src/web/app/common/views/components/othello.vue
index 81da02d1c4..d650322341 100644
--- a/src/web/app/common/views/components/othello.vue
+++ b/src/web/app/common/views/components/othello.vue
@@ -78,7 +78,8 @@ export default Vue.extend({
matching: null,
invitations: [],
connection: null,
- connectionId: null
+ connectionId: null,
+ pingClock: null
};
},
watch: {
@@ -112,17 +113,29 @@ export default Vue.extend({
(this as any).api('othello/invitations').then(invitations => {
this.invitations = this.invitations.concat(invitations);
});
+
+ this.pingClock = setInterval(() => {
+ if (this.matching) {
+ this.connection.send({
+ type: 'ping',
+ id: this.matching.id
+ });
+ }
+ }, 3000);
},
beforeDestroy() {
this.connection.off('matched', this.onMatched);
this.connection.off('invited', this.onInvited);
(this as any).os.streams.othelloStream.dispose(this.connectionId);
+
+ clearInterval(this.pingClock);
},
methods: {
go(game) {
(this as any).api('othello/games/show', {
game_id: game.id
}).then(game => {
+ this.matching = null;
this.game = game;
});
},
@@ -154,11 +167,13 @@ export default Vue.extend({
user_id: invitation.parent.id
}).then(game => {
if (game) {
+ this.matching = null;
this.game = game;
}
});
},
onMatched(game) {
+ this.matching = null;
this.game = game;
},
onInvited(invite) {