mirror of
https://github.com/danbulant/slightlyComplicatedTicTacToe
synced 2026-07-05 19:20:50 +00:00
fix leaving in wait
This commit is contained in:
parent
df026dd466
commit
b92ec82d4e
2 changed files with 8 additions and 2 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import { quadOut } from "svelte/easing";
|
import { quadOut } from "svelte/easing";
|
||||||
import { fly } from "svelte/transition";
|
import { fly } from "svelte/transition";
|
||||||
import { room } from "./websocket";
|
import { connection, room } from "./websocket";
|
||||||
|
|
||||||
const duration = 400;
|
const duration = 400;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href="/multiplayer" class="arrow-back fixed top-0 left-0 w-4 h-4 m-4 p-2 transform transition-transform hover:-translate-x-1">
|
<a on:click={() => { $connection?.leave() }} href="/multiplayer" class="arrow-back fixed top-0 left-0 w-4 h-4 m-4 p-2 transform transition-transform hover:-translate-x-1">
|
||||||
<svg width="16" height="16">
|
<svg width="16" height="16">
|
||||||
<line y1="50%" x1="0" y2="50%" x2="100%" stroke="currentColor" stroke-width="2" />
|
<line y1="50%" x1="0" y2="50%" x2="100%" stroke="currentColor" stroke-width="2" />
|
||||||
<line y1="50%" x1="0" y2="100%" x2="50%" stroke="currentColor" stroke-width="2" />
|
<line y1="50%" x1="0" y2="100%" x2="50%" stroke="currentColor" stroke-width="2" />
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,12 @@ export class WebsocketConnection extends EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
leave() {
|
leave() {
|
||||||
|
connection.set(null);
|
||||||
|
room.set(null);
|
||||||
|
messages.set([]);
|
||||||
|
gameData.set(null);
|
||||||
|
listLoading.set(false);
|
||||||
|
list.set(null);
|
||||||
this.ws.close();
|
this.ws.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue