DefinitelyTyped/types/workbox-background-sync
owcs-solx 3ef8e1ec49
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
2020-04-17 14:10:08 -07:00
..
index.d.ts
Plugin.d.ts
Queue.d.ts
tsconfig.json
tslint.json
workbox-background-sync-tests.ts