mwg API
    Preparing search index...

    Function memoryStorage

    • Test doubles for the seams mwg already takes by injection, so a game's tests (and this repository's own) do not each rewrite them: a storage for SaveSystem, Settings, Collection and the stored counters, a Playable for Sound/Music's create, a socket for LockstepClient's create, and a fetch for every HttpTransport client. Renderer-free and dependency-free, and kept off the root barrel, so nothing here reaches a shipped game unless a test imports it.

      Returns SaveStorage

      import { SaveSystem } from '@datamoc/mwg/core';
      import { memoryStorage } from '@datamoc/mwg/testing';

      const saves = new SaveSystem<{ gold: number }>({ namespace: 'test', version: 1, storage: memoryStorage() });
      saves.save('slot1', { gold: 3 });