Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

494 B
Raw Blame
// ©AngelaMos | 2026
// freshness.ts

import { create } from 'zustand'

export type SourceKey =
  | 'bgp'
  | 'outage'
  | 'kev'
  | 'ransomware'
  | 'dshield'
  | 'cve'
  | 'spacewx'
  | 'iss'
  | 'quake'
  | 'btc'
  | 'eth'
  | 'wiki'
  | 'ws'

interface FreshnessStore {
  ts: Partial<Record<SourceKey, number>>
  ping: (k: SourceKey) => void
}

export const useFreshness = create<FreshnessStore>((set) => ({
  ts: {},
  ping: (k) => set((s) => ({ ts: { ...s.ts, [k]: Date.now() } })),
}))