mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Fix the signature for onSync for @types/workbox-background-sync (#43950)
* Fix incorrect onSync type
The type for onSync is incorrect. It should contain an argument containing the `queue` property.
From the documentation for `workbox-background-sync:4.3.0`:
```
* @param {Function} [options.onSync] A function that gets invoked whenever
* the 'sync' event fires. The function is invoked with an object
* containing the `queue` property (referencing this instance), and you
* can use the callback to customize the replay behavior of the queue.
* When not set the `replayRequests()` method is called.
* Note: if the replay fails after a sync event, make sure you throw an
* error, so the browser knows to retry the sync event later.
```
* Extract callback as a new type
Update definition in accordance to suggested changes by @JasonHK.
For consistency sake, this is identical to https://github.com/GoogleChrome/workbox/blob/master/packages/workbox-background-sync/src/Queue.ts.
* Fix test failures
* Update as per suggestions by @JasonHK
This commit is contained in:
parent
9f76d795b2
commit
3ef8e1ec49
10
types/workbox-background-sync/Queue.d.ts
vendored
10
types/workbox-background-sync/Queue.d.ts
vendored
@ -9,9 +9,17 @@ export class Queue {
|
||||
unshiftRequest(entry: QueueEntry): Promise<void>;
|
||||
}
|
||||
|
||||
export interface QueueOnSyncEvent {
|
||||
queue: Queue;
|
||||
}
|
||||
|
||||
export interface QueueOnSyncHandler {
|
||||
(options: QueueOnSyncEvent): void|Promise<void>;
|
||||
}
|
||||
|
||||
export interface QueueOptions {
|
||||
maxRetentionTime?: number;
|
||||
onSync?: () => void;
|
||||
onSync?: QueueOnSyncHandler;
|
||||
}
|
||||
|
||||
export interface QueueEntry<Metadata = any> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user