Skip to content

Function: awaitPluginInit()

ts
function awaitPluginInit(): Promise<void>;

Waits for the Vue ReActiveRecord plugin to finish initializing the real database in a browser context.

Returns

Promise<void>

A promise that resolves when the real database is ready for use.

Remarks

This is useful for code that needs to ensure the real database is ready (not just the SSR stub) before running queries or mutations. In SSR or if the database is already ready, this resolves immediately.

Example

typescript
import { awaitPluginInit, useReActiveModel } from "@nhtio/vue-re-active-record";

await awaitPluginInit();
const users = await useReActiveModel("user").all();

See

VueReActiveRecordPlugin.awaitPluginInit