@coveord/blitz-ui-2022
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "@coveord/blitz-ui-2022", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"module": "dist/index.es.min.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -10,3 +10,5 @@ import { createSocket } from '../sockets/socket'; | ||
let ticks = createHistory<EnhancedTick>(); | ||
export type TicksStore = typeof ticks; | ||
export const games = createHistory<typeof ticks>(); | ||
@@ -22,3 +24,3 @@ | ||
onClose: () => { | ||
console.log(get(get(games).current).list); | ||
console.log(get(get(games)?.current)?.list); | ||
isConnected.set(false); | ||
@@ -25,0 +27,0 @@ }, |
import { derived, writable } from "svelte/store"; | ||
export function createHistory<T>() { | ||
const list = writable<T[]>([]); | ||
const index = writable<number>(-1); | ||
export function createHistory<T>(initial: T[] = []) { | ||
const list = writable<T[]>(initial); | ||
const index = writable<number>(initial.length > 0 ? 0 : -1); | ||
@@ -7,0 +7,0 @@ const {subscribe} = derived([list, index], ([list, index]) => { |
@@ -18,3 +18,3 @@ import type { EnhancedTick } from '../../gametypings'; | ||
const logs: GameLogEntry[] = []; | ||
ticks.slice(Math.max(0, currentIndex - 50), currentIndex).forEach((tick) => { | ||
ticks.slice(Math.max(0, currentIndex - 50), currentIndex + 1).forEach((tick) => { | ||
const attackersAlreadyInLog = []; | ||
@@ -42,1 +42,8 @@ Object.values(tick.allUnitsPerId) | ||
}; | ||
export const getNextImportantTick = (ticks: EnhancedTick[], currentIndex: number): number | undefined => { | ||
if (!ticks) { | ||
return undefined; | ||
} | ||
return ticks.slice(currentIndex + 1).find((tick) => Object.values(tick.allUnitsPerId).find((unit) => !!unit.lastState.wasAttackedBy))?.tick; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9036069
71
2300
1