misskey-awawa/src/web/app/common/views/components/othello.game.vue

30 lines
653 B
Vue
Raw Normal View History

2018-03-07 02:40:40 +00:00
<template>
<div>
<header>:{{ game.black_user.name }} :{{ game.white_user.name }}</header>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: ['game'],
data() {
return {
game: null,
connection: null,
connectionId: null
};
},
mounted() {
this.connection = (this as any).os.streams.othelloGameStream.getConnection();
this.connectionId = (this as any).os.streams.othelloGameStream.use();
this.connection.on('set', this.onSet);
},
beforeDestroy() {
this.connection.off('set', this.onSet);
(this as any).streams.othelloGameStream.dispose(this.connectionId);
},
});
</script>