|
8 | 8 | * @since v4.0.0 |
9 | 9 | */ |
10 | 10 | /// persister-sqlite-wasm |
| 11 | +/** |
| 12 | + * The SqliteWasmPersister interface is a minor extension to the Persister |
| 13 | + * interface. |
| 14 | + * |
| 15 | + * It simply provides an extra getDb method for accessing a reference to the |
| 16 | + * database instance the Store is being persisted to. |
| 17 | + * @since v4.3.14 |
| 18 | + */ |
| 19 | +/// SqliteWasmPersister |
| 20 | +{ |
| 21 | + /** |
| 22 | + * The getDb method returns a reference to the database instance the Store is |
| 23 | + * being persisted to. |
| 24 | + * @returns A reference to the database instance. |
| 25 | + * @example |
| 26 | + * This example creates a Persister object against a newly-created Store and |
| 27 | + * then gets the database instance back out again. |
| 28 | + * |
| 29 | + * ```js |
| 30 | + * const sqlite3 = await sqlite3InitModule(); |
| 31 | + * const db = new sqlite3.oo1.DB(':memory:', 'c'); |
| 32 | + * const store = createStore().setTables({pets: {fido: {species: 'dog'}}}); |
| 33 | + * const persister = createSqliteWasmPersister( |
| 34 | + * store, |
| 35 | + * sqlite3, |
| 36 | + * db, |
| 37 | + * 'my_tinybase', |
| 38 | + * ); |
| 39 | + * |
| 40 | + * console.log(persister.getDb() == db); |
| 41 | + * // -> true |
| 42 | + * |
| 43 | + * persister.destroy(); |
| 44 | + * ``` |
| 45 | + * @category Getter |
| 46 | + * @since v4.3.14 |
| 47 | + */ |
| 48 | + /// SqliteWasmPersister.getDb |
| 49 | +} |
11 | 50 | /** |
12 | 51 | * The createSqliteWasmPersister function creates a Persister object that can |
13 | 52 | * persist the Store to a local SQLite database (in an appropriate environment). |
|
40 | 79 | * @param onIgnoredError An optional handler for the errors that the Persister |
41 | 80 | * would otherwise ignore when trying to save or load data. This is suitable for |
42 | 81 | * debugging persistence issues in a development environment, since v4.0.4. |
43 | | - * @returns A reference to the new Persister object. |
| 82 | + * @returns A reference to the new SqliteWasmPersister object. |
44 | 83 | * @example |
45 | | - * This example creates a Persister object and persists the Store to a local |
46 | | - * SQLite database as a JSON serialization into the `my_tinybase` table. It |
47 | | - * makes a change to the database directly and then reloads it back into the |
| 84 | + * This example creates a SqliteWasmPersister object and persists the Store to a |
| 85 | + * local SQLite database as a JSON serialization into the `my_tinybase` table. |
| 86 | + * It makes a change to the database directly and then reloads it back into the |
48 | 87 | * Store. |
49 | 88 | * |
50 | 89 | * ```js |
|
75 | 114 | * persister.destroy(); |
76 | 115 | * ``` |
77 | 116 | * @example |
78 | | - * This example creates a Persister object and persists the Store to a local |
79 | | - * SQLite database with tabular mapping. |
| 117 | + * This example creates a SqliteWasmPersister object and persists the Store to a |
| 118 | + * local SQLite database with tabular mapping. |
80 | 119 | * |
81 | 120 | * ```js |
82 | 121 | * const sqlite3 = await sqlite3InitModule(); |
|
0 commit comments