Example
Type Parameters
Constructors
Constructor
new LiveData<Defined in: packages/modelence/src/live-query/context.ts:69T>(config):LiveData<T>
Parameters
Returns
LiveData<T>
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import { LiveData } from 'modelence/server';
...
getTodos({ userId }, context) {
return new LiveData({
fetch: async () => await dbTodos.fetch({ userId }),
watch: ({ publish }) => {
// Subscribe to changes and call publish when data changes
listener.onChange(publish);
return () => {
// Cleanup function to unsubscribe from changes
};
}
});
}
| Type Parameter | Default type |
|---|---|
T | unknown |
new LiveData<Defined in: packages/modelence/src/live-query/context.ts:69T>(config):LiveData<T>
| Parameter | Type |
|---|---|
config | LiveDataConfig<T> |
LiveData<T>
| Property | Modifier | Type | Defined in |
|---|---|---|---|
fetch | readonly | () => T | Promise<T> | packages/modelence/src/live-query/context.ts:66 |
watch | readonly | LiveQueryWatch | packages/modelence/src/live-query/context.ts:67 |