fix: useEvent for clock/place games
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { useWebSocket } from '@vueuse/core'
|
||||
import { clockApiMyStats } from '@/api'
|
||||
import { useEventPath } from './useEventPath'
|
||||
|
||||
// Mirrors clock/wire.py: a one-letter type tag then '|'-separated fields, in a
|
||||
// fixed order the server always uses. See that file for the message table.
|
||||
@@ -10,9 +9,7 @@ import { useEventPath } from './useEventPath'
|
||||
// "not logged in" branch to handle here.
|
||||
const RECONNECT_DELAY_MS = 1000
|
||||
|
||||
export function useClockSocket() {
|
||||
const eventPath = useEventPath()
|
||||
|
||||
export function useClockSocket(eventPath: string) {
|
||||
const endTimeMs = ref<number | null>(null)
|
||||
const offsetMs = ref(0)
|
||||
const remainingMs = ref(0)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { useWebSocket } from '@vueuse/core'
|
||||
import { placeApiCanvas } from '@/api'
|
||||
import { useEventPath } from './useEventPath'
|
||||
|
||||
// Mirrors place/wire.py: a one-letter type tag then '|'-separated fields, in
|
||||
// a fixed order the server always uses. See that file for the message table.
|
||||
@@ -27,9 +26,7 @@ let grid = new Uint8Array(DEFAULT_GRID_SIZE * DEFAULT_GRID_SIZE)
|
||||
const gridWidth = ref(DEFAULT_GRID_SIZE)
|
||||
const gridHeight = ref(DEFAULT_GRID_SIZE)
|
||||
|
||||
export function usePlaceSocket(onPixel?: OnPixel, onResize?: OnResize) {
|
||||
const eventPath = useEventPath()
|
||||
|
||||
export function usePlaceSocket(eventPath: string, onPixel?: OnPixel, onResize?: OnResize) {
|
||||
const cooldownEndMs = ref<number | null>(null)
|
||||
const cooldownRemainingMs = ref(0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user