mwg API
    Preparing search index...

    Interface RunHistoryEntry<T>

    A personal, local record of completed runs - what core.Session (launch count) and core.Achievements (derived unlocks, no per-run record) don't keep, and distinct from SaveSystem.list(), which enumerates continuable slots, not runs already over.

    mwg stays agnostic about what a run's own report actually contains, the same way SaveSystem stays agnostic about what "the save" contains: a game supplies its own summary shape (score, cause of death, floor reached, whatever it considers a run's own stats) and this only ever stores, lists, and sorts it.

    import { RunHistory } from '@datamoc/mw_games/core';

    interface RunSummary { score: number; cause: string }

    const runs = new RunHistory<RunSummary>({ namespace: 'my-game', limit: 20 });
    runs.record({ score: 340, cause: 'slain by a rat' });

    const best = runs.ranked((summary) => summary.score, 'desc');
    interface RunHistoryEntry<T> {
        endedAt: number;
        id: string;
        summary: T;
    }

    Type Parameters

    • T
    Index
    endedAt: number
    id: string
    summary: T