createQueries
The createQueries
function creates a Queries
object, and is the main entry point into the queries
module.
createQueries(store: Store): Queries
Type | Description | |
---|---|---|
store | Store | The |
returns | Queries | A reference to the new |
A given Store
can only have one Queries
object associated with it. If you call this function twice on the same Store
, your second call will return a reference to the Queries
object created by the first.
Examples
This example creates a Queries
object.
import {createQueries, createStore} from 'tinybase';
const store = createStore();
const queries = createQueries(store);
console.log(queries.getQueryIds());
// -> []
This example creates a Queries
object, and calls the method a second time for the same Store
to return the same object.
import {createQueries, createStore} from 'tinybase';
const store = createStore();
const queries1 = createQueries(store);
const queries2 = createQueries(store);
console.log(queries1 === queries2);
// -> true
Since
v2.0.0