Documentation
    Preparing search index...

    Function resourceCatalog

    • Builds both halves of a SceneResourceCatalog from one map of logical key → resource (§79, 2026-08-07).

      const materials = resourceCatalog([
      ["materials/brick", brick],
      ["materials/glass", glass],
      ]);
      const io = registerSceneNodeTypes({ materials, geometries });

      One map rather than two functions because the two directions have to agree: a keyOf writing a key its get cannot resolve produces a document that saves cleanly and refuses to load, which is the failure this whole seam exists to make impossible.

      A resource published under two keys keeps the first, in iteration order, so the document a scene writes does not depend on which alias the caller happened to look up — both keys still resolve, so nothing is lost.

      Type Parameters

      • T extends object

      Parameters

      • entries: Iterable<readonly [string, T]>

        logical key → resource, in any iterable form a Map accepts

      Returns Required<SceneResourceCatalog<T>>

      a catalog with both halves populated

      FourError INVALID_APPLICATION_STATE if one key names two resources — the read side could only pick arbitrarily, and §79 keys resolve to exactly one thing