mwg API
    Preparing search index...

    Class Collection

    A named collection of records, queried and filtered - the shape SaveSystem does not cover. A save slot is one blob loaded wholesale; a collection is many small records asked questions: where((q) => !q.done) is "everything not yet completed".

    Every call hits the storage directly - nothing is cached, so there is no copy to go stale, and two Collection objects over the same name agree trivially. Records come back in insertion order. Built for logs and bestiaries (hundreds of records), not for anything scanned per frame.

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

    const quests = new Collection('quests');
    quests.put({ id: 'rats', stage: 1, done: false });
    quests.put({ id: 'shopkeeper', stage: 3, done: true });

    const active = quests.where((q) => !q.done);
    console.log(quests.size, active.length); // 2 1
    Index
    • empties this collection, and nothing else sharing the storage

      Returns void