@serwist/background-sync 9.0.0-preview.7 → 9.0.0-preview.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
1
|
+
import type { FetchDidFailCallbackParam, SerwistPlugin } from "@serwist/core";
|
|
2
2
|
import type { QueueOptions } from "./Queue.js";
|
|
3
3
|
/**
|
|
4
4
|
* A class implementing the `fetchDidFail` lifecycle callback. This makes it
|
|
5
5
|
* easier to add failed requests to a background sync Queue.
|
|
6
6
|
*/
|
|
7
|
-
declare class BackgroundSyncPlugin implements SerwistPlugin {
|
|
7
|
+
export declare class BackgroundSyncPlugin implements SerwistPlugin {
|
|
8
8
|
private readonly _queue;
|
|
9
9
|
/**
|
|
10
10
|
* @param name See the `@serwist/background-sync.Queue`
|
|
@@ -17,7 +17,6 @@ declare class BackgroundSyncPlugin implements SerwistPlugin {
|
|
|
17
17
|
* @param options
|
|
18
18
|
* @private
|
|
19
19
|
*/
|
|
20
|
-
fetchDidFail:
|
|
20
|
+
fetchDidFail({ request }: FetchDidFailCallbackParam): Promise<void>;
|
|
21
21
|
}
|
|
22
|
-
export { BackgroundSyncPlugin };
|
|
23
22
|
//# sourceMappingURL=BackgroundSyncPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundSyncPlugin.d.ts","sourceRoot":"","sources":["../src/BackgroundSyncPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"BackgroundSyncPlugin.d.ts","sourceRoot":"","sources":["../src/BackgroundSyncPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAE/B;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAIhD;;;OAGG;IACG,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,yBAAyB;CAG1D"}
|
package/dist/index.js
CHANGED
|
@@ -431,11 +431,11 @@ class BackgroundSyncPlugin {
|
|
|
431
431
|
constructor(name, options){
|
|
432
432
|
this._queue = new Queue(name, options);
|
|
433
433
|
}
|
|
434
|
-
|
|
434
|
+
async fetchDidFail({ request }) {
|
|
435
435
|
await this._queue.pushRequest({
|
|
436
436
|
request
|
|
437
437
|
});
|
|
438
|
-
}
|
|
438
|
+
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
export { BackgroundSyncPlugin, Queue, QueueStore, StorableRequest };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/background-sync",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.9",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A module that queues failed requests and uses the Background Synchronization API to replay them when the network is available",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"idb": "8.0.0",
|
|
34
|
-
"@serwist/core": "9.0.0-preview.
|
|
34
|
+
"@serwist/core": "9.0.0-preview.9"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"cross-env": "7.0.3",
|
|
38
38
|
"rollup": "4.9.6",
|
|
39
39
|
"typescript": "5.4.0-dev.20240206",
|
|
40
|
-
"@serwist/constants": "9.0.0-preview.
|
|
40
|
+
"@serwist/constants": "9.0.0-preview.9"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"typescript": ">=5.0.0"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
9
|
+
import type { FetchDidFailCallbackParam, SerwistPlugin } from "@serwist/core";
|
|
10
10
|
|
|
11
11
|
import type { QueueOptions } from "./Queue.js";
|
|
12
12
|
import { Queue } from "./Queue.js";
|
|
@@ -15,7 +15,7 @@ import { Queue } from "./Queue.js";
|
|
|
15
15
|
* A class implementing the `fetchDidFail` lifecycle callback. This makes it
|
|
16
16
|
* easier to add failed requests to a background sync Queue.
|
|
17
17
|
*/
|
|
18
|
-
class BackgroundSyncPlugin implements SerwistPlugin {
|
|
18
|
+
export class BackgroundSyncPlugin implements SerwistPlugin {
|
|
19
19
|
private readonly _queue: Queue;
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -32,9 +32,7 @@ class BackgroundSyncPlugin implements SerwistPlugin {
|
|
|
32
32
|
* @param options
|
|
33
33
|
* @private
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
async fetchDidFail({ request }: FetchDidFailCallbackParam) {
|
|
36
36
|
await this._queue.pushRequest({ request });
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export { BackgroundSyncPlugin };
|