• Parameters

    • debugName: string

      Only used internally for diagnostics, not available to user code

    • stores: Stores
    • OptionalbackingStore: MapStore<string, any> = undefined

    Returns {
        makeOnce: (<V>(key: string, maker: ((key: string) => V)) => V);
        wrapProvider: (<T>(provider: T, labelToKeys??: ((label: string) => string[])) => T);
    }

    • makeOnce: (<V>(key: string, maker: ((key: string) => V)) => V)
        • <V>(key, maker): V
        • The best way to understand the purpose of makeOnce is to first understand what makeOnce does on a durable zone. Used correctly, makeOnce should only be called at most once on any zone,key pair during any vat incarnation. Given that constraint, if there is already a value bound to that zone,key pair, it must have been left there by a previous incarnation and makeOnce will simply return it. If not, then maker(key) is called to determine the initial value of that slot, which will normally be preserved by similar calls to makeOnce in future incarnations --- though that will be up to them.

          Also ensures the maker returns a storable value.

          Type Parameters

          • V

          Parameters

          • key: string

            The string name of the Zone slot to provide.

          • maker: ((key: string) => V)

            Called to create a fresh value to fill an empty slot.

              • (key): V
              • Parameters

                • key: string

                Returns V

          Returns V

          The value of the key's slot.

    • wrapProvider: (<T>(provider: T, labelToKeys??: ((label: string) => string[])) => T)
        • <T>(provider, labelToKeys?): T
        • Ensure the wrapped function is only called once per incarnation. It is expected to update the backing store directly.

          Type Parameters

          • T extends ((key: string, ...rest: any[]) => any)

          Parameters

          • provider: T
          • OptionallabelToKeys: ((label: string) => string[]) = defaultLabelToKeys
              • (label): string[]
              • Parameters

                • label: string

                Returns string[]

          Returns T