Skip to content

API reference > @kontsedal/olas-core > Root

Root type ​

The handle createRoot(...) returns. The root controller's public api lives on api; everything else is the root's own surface — lifecycle, SSR, scope lookup, imperative query operations and the devtools bus. Keeping the two apart means a controller may return anything, including members nameddispose or suspend, and the root can grow new controls without taking a name from anyone's api. Spec §20.8.

Signature:

typescript
type Root<Api> = {
  readonly api: Api;
  bindQuery<Args extends unknown[], T>(query: Query<Args, T>, options?: BindQueryOptions): QueryActions<Args, T>;
  bindQuery<Args extends unknown[], TPage, TItem>(query: InfiniteQuery<Args, TPage, TItem>, options?: BindQueryOptions): InfiniteQueryActions<Args, TPage, TItem>;
  inject<T>(scope: Scope<T>): T;
  dispose(): void;
  suspend(options?: SuspendOptions): void;
  resume(): void;
  dehydrate(): DehydratedState;
  hydrate(state: DehydratedState): void;
  waitForIdle(): Promise<void>;
  readonly debug: DebugBus;
};

References: Query, BindQueryOptions, QueryActions, InfiniteQuery, InfiniteQueryActions, Scope, SuspendOptions, DehydratedState, DebugBus

Released under the MIT License.