Hiyve Components - v1.0.0
    Preparing search index...

    Function createResultStore

    • A result store over any place that can hold a list — a file, a table, a document, a cloud bucket: give it how to read the list back and how to write it, and it does the rest. Results are kept whole; the adapter never needs to understand them. Nothing in the list is ever lost on a write: a result kept at an older version is brought up to this one (migrateGameResult) and written back so, and anything the store does not know — a result of a newer version, something else kept under the same key — is written back exactly as it was found; only results are listed. Saves, removals and reads run one after another. The store keeps the newest limit results (500 unless told otherwise): as one is saved past that, the oldest go.

      Parameters

      Returns ResultStore

      const store = createResultStore({
      read: async () => (await db.get('results')) ?? [],
      write: async (items) => db.put('results', items),
      });
      await store.save(result);