NameAdmin: {
    default: (<T>(key: string, newValue: T, newAdmin?: NameAdmin) => T);
    delete: ((key: string) => void);
    lookupAdmin: ((...path: string[]) => Promise<NameAdmin>);
    onUpdate: ((fn: undefined | NameHubUpdateHandler) => void);
    provideChild: ((key: string, reserved?: string[]) => Promise<NameHubKit>);
    readonly: (() => NameHub);
    reserve: ((key: string) => Promise<void>);
    set: ((key: string, newValue: any, newAdmin?: NameAdmin) => void);
    update: ((key: string, newValue: any, newAdmin?: NameAdmin) => void);
}

write access to a node in a name hierarchy

Type declaration

  • default: (<T>(key: string, newValue: T, newAdmin?: NameAdmin) => T)

    Update if not already updated. Return existing value, or newValue if not existing.

      • <T>(key, newValue, newAdmin?): T
      • Type Parameters

        • T

        Parameters

        Returns T

  • delete: ((key: string) => void)

    Delete a value and reject an outstanding reserved promise (if any).

      • (key): void
      • Parameters

        • key: string

        Returns void

  • lookupAdmin: ((...path: string[]) => Promise<NameAdmin>)

    Look up the newAdmin from the path of keys starting from the current NameAdmin. Wait on any reserved promises.

  • onUpdate: ((fn: undefined | NameHubUpdateHandler) => void)

    Set a function to be called whenever an update or deletion is made, with all the entries as of that point.

    Note: can be called at most once.

  • provideChild: ((key: string, reserved?: string[]) => Promise<NameHubKit>)
      • (key, reserved?): Promise<NameHubKit>
      • Parameters

        • key: string
        • Optionalreserved: string[]

        Returns Promise<NameHubKit>

  • readonly: (() => NameHub)

    get the NameHub corresponding to the current NameAdmin

  • reserve: ((key: string) => Promise<void>)

    Mark a key as reserved; will return a promise that is fulfilled when the key is updated (or rejected when deleted). If the key was already set it does nothing.

      • (key): Promise<void>
      • Parameters

        • key: string

        Returns Promise<void>

  • set: ((key: string, newValue: any, newAdmin?: NameAdmin) => void)

    Update only if already initialized. Reject if not.

      • (key, newValue, newAdmin?): void
      • Parameters

        • key: string
        • newValue: any
        • OptionalnewAdmin: NameAdmin

        Returns void

  • update: ((key: string, newValue: any, newAdmin?: NameAdmin) => void)

    Fulfill an outstanding reserved promise (if any) to the newValue and set the key to the newValue. If newAdmin is provided, set that to return via lookupAdmin.

      • (key, newValue, newAdmin?): void
      • Parameters

        • key: string
        • newValue: any
        • OptionalnewAdmin: NameAdmin

        Returns void