mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-04 20:06:06 +02:00
This commit is contained in:
@@ -44,6 +44,10 @@ class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
send(message) {
|
||||
this.socket.send(JSON.stringify(message));
|
||||
}
|
||||
|
||||
close() {
|
||||
this.socket.removeEventListener('open', this.onOpen);
|
||||
this.socket.removeEventListener('message', this.onMessage);
|
||||
|
||||
@@ -70,11 +70,16 @@
|
||||
<script>
|
||||
this.mixin('api');
|
||||
|
||||
this.post = this.opts.post;
|
||||
this.poll = this.post.poll;
|
||||
this.total = this.poll.choices.reduce((a, b) => a + b.votes, 0);
|
||||
this.isVoted = this.poll.choices.some(c => c.is_voted);
|
||||
this.result = this.isVoted;
|
||||
this.init = post => {
|
||||
this.post = post;
|
||||
this.poll = this.post.poll;
|
||||
this.total = this.poll.choices.reduce((a, b) => a + b.votes, 0);
|
||||
this.isVoted = this.poll.choices.some(c => c.is_voted);
|
||||
this.result = this.isVoted;
|
||||
this.update();
|
||||
};
|
||||
|
||||
this.init(this.opts.post);
|
||||
|
||||
this.toggleResult = () => {
|
||||
this.result = !this.result;
|
||||
|
||||
Reference in New Issue
Block a user