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