Skip to content

Commit 1499b46

Browse files
committed
[docs] Types for delPersisterListener
1 parent 1d52c71 commit 1499b46

4 files changed

Lines changed: 17 additions & 12 deletions

File tree

src/@types/persisters/docs.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,8 @@
16131613
* called. This function can be asynchronous.
16141614
* @param delPersisterListener A function that will unregister the listener from
16151615
* the underlying changes to the persistence layer. It receives whatever was
1616-
* returned from your `addPersisterListener` implementation.
1616+
* returned from your `addPersisterListener` implementation. This function can
1617+
* be asynchronous.
16171618
* @param onIgnoredError An optional handler for the errors that the Persister
16181619
* would otherwise ignore when trying to save or load data. This is suitable for
16191620
* debugging persistence issues in a development environment, since v4.0.4.
@@ -1773,8 +1774,8 @@
17731774
*/
17741775
/// createCustomSqlitePersister
17751776
/**
1776-
* The createCustomSqlitePersister function creates a Persister object that you
1777-
* can configure to persist the Store to a PostgreSQL database.
1777+
* The createCustomPostgreSqlPersister function creates a Persister object that
1778+
* you can configure to persist the Store to a PostgreSQL database.
17781779
*
17791780
* This is only used when developing custom database-oriented Persisters, and
17801781
* most TinyBase users will not need to be particularly aware of it.
@@ -1789,10 +1790,10 @@
17891790
* that will be used as the name of the Store's table in the database.
17901791
* @param executeCommand A function that will execute a command against the
17911792
* database.
1792-
* @param addChangeListener A function that will register a listener for changes
1793-
* to the database.
1794-
* @param delChangeListener A function that will unregister the listener for
1795-
* changes to the database.
1793+
* @param addChangeListener An asynchronous function that will register a
1794+
* listener for changes to the database.
1795+
* @param delChangeListener An asynchronous function that will unregister the
1796+
* listener for changes to the database.
17961797
* @param onSqlCommand A function that will be called for each SQL command
17971798
* executed against the database.
17981799
* @param onIgnoredError An optional handler for the errors that the Persister

src/@types/persisters/index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ export function createCustomPersister<
228228
addPersisterListener: (
229229
listener: PersisterListener<Persist>,
230230
) => ListenerHandle | Promise<ListenerHandle>,
231-
delPersisterListener: (listenerHandle: ListenerHandle) => void,
231+
delPersisterListener: (
232+
listenerHandle: ListenerHandle,
233+
) => void | Promise<void>,
232234
onIgnoredError?: (error: any) => void,
233235
persist?: Persist,
234236
): Persister<Persist>;
@@ -263,7 +265,7 @@ export function createCustomPostgreSqlPersister<
263265
channel: string,
264266
listener: DatabaseChangeListener,
265267
) => Promise<ListenerHandle>,
266-
delChangeListener: (listenerHandle: ListenerHandle) => void,
268+
delChangeListener: (listenerHandle: ListenerHandle) => void | Promise<void>,
267269
onSqlCommand: ((sql: string, params?: any[]) => void) | undefined,
268270
onIgnoredError: ((error: any) => void) | undefined,
269271
destroy: () => void,

src/@types/persisters/with-schemas/index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ export function createCustomPersister<
253253
addPersisterListener: (
254254
listener: PersisterListener<Schemas, Persist>,
255255
) => ListenerHandle | Promise<ListenerHandle>,
256-
delPersisterListener: (listenerHandle: ListenerHandle) => void,
256+
delPersisterListener: (
257+
listenerHandle: ListenerHandle,
258+
) => void | Promise<void>,
257259
onIgnoredError?: (error: any) => void,
258260
persist?: Persist,
259261
): Persister<Schemas, Persist>;
@@ -290,7 +292,7 @@ export function createCustomPostgreSqlPersister<
290292
channel: string,
291293
listener: DatabaseChangeListener,
292294
) => Promise<ListenerHandle>,
293-
delChangeListener: (listenerHandle: ListenerHandle) => void,
295+
delChangeListener: (listenerHandle: ListenerHandle) => void | Promise<void>,
294296
onSqlCommand: ((sql: string, params?: any[]) => void) | undefined,
295297
onIgnoredError: ((error: any) => void) | undefined,
296298
destroy: () => void,

src/persisters/common/database/postgresql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const createCustomPostgreSqlPersister = <
5959
channel: string,
6060
listener: DatabaseChangeListener,
6161
) => Promise<ListenerHandle>,
62-
delChangeListener: (listenerHandle: ListenerHandle) => void,
62+
delChangeListener: (listenerHandle: ListenerHandle) => Promise<void>,
6363
onSqlCommand: ((sql: string, params?: any[]) => void) | undefined,
6464
onIgnoredError: ((error: any) => void) | undefined,
6565
destroy: () => void,

0 commit comments

Comments
 (0)