@serwist/window 9.0.0-preview.8 → 9.0.0
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.
- package/dist/Serwist.d.ts +7 -9
- package/dist/Serwist.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/messageSW.d.ts +3 -4
- package/dist/messageSW.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/Serwist.ts +8 -10
- package/src/messageSW.ts +3 -4
package/dist/Serwist.d.ts
CHANGED
|
@@ -95,23 +95,21 @@ export declare class Serwist extends SerwistEventTarget {
|
|
|
95
95
|
getSW(): Promise<ServiceWorker>;
|
|
96
96
|
/**
|
|
97
97
|
* Sends the passed data object to the service worker registered by this
|
|
98
|
-
* instance (via
|
|
99
|
-
* with a response (if any).
|
|
98
|
+
* instance (via `getSW`) and resolves with a response (if any).
|
|
100
99
|
*
|
|
101
|
-
* A response can be
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* resolve.
|
|
100
|
+
* A response can be sent by calling `event.ports[0].postMessage(...)`, which will
|
|
101
|
+
* resolve the promise returned by `messageSW()`. If no response is sent, the promise
|
|
102
|
+
* will never resolve.
|
|
105
103
|
*
|
|
106
104
|
* @param data An object to send to the service worker
|
|
107
105
|
* @returns
|
|
108
106
|
*/
|
|
109
107
|
messageSW(data: any): Promise<any>;
|
|
110
108
|
/**
|
|
111
|
-
* Sends a `{type:
|
|
112
|
-
* currently
|
|
109
|
+
* Sends a `{ type: "SKIP_WAITING" }` message to the service worker that is
|
|
110
|
+
* currently waiting and associated with the current registration.
|
|
113
111
|
*
|
|
114
|
-
* If there is no current registration or no service worker is
|
|
112
|
+
* If there is no current registration, or no service worker is waiting,
|
|
115
113
|
* calling this will have no effect.
|
|
116
114
|
*/
|
|
117
115
|
messageSkipWaiting(): void;
|
package/dist/Serwist.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Serwist.d.ts","sourceRoot":"","s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M,IAAI,OAAO,CAAC,aAAa,CAAC,CAEnC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC,CAExC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC;IAM/B;;;;;;;;;;OAUG;IAEG,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAKxC;;;;;;OAMG;IACH,kBAAkB,IAAI,IAAI;IAM1B;;;;;;OAMG;IACH,OAAO,CAAC,6BAA6B;IAQrC;;;;;OAKG;YACW,eAAe;IAsB7B;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAsE7B;IAEF;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAqF7B;IAEF;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAuBlC;IAEF;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAuBzB;CACH;AAKD;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;GAaG"}
|
package/dist/index.js
CHANGED
package/dist/messageSW.d.ts
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Sends a data object to a service worker via `postMessage` and resolves with
|
|
3
3
|
* a response (if any).
|
|
4
4
|
*
|
|
5
|
-
* A response can be
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* resolve.
|
|
5
|
+
* A response can be sent by calling `event.ports[0].postMessage(...)`, which will
|
|
6
|
+
* resolve the promise returned by `messageSW()`. If no response is sent, the promise
|
|
7
|
+
* will never resolve.
|
|
9
8
|
*
|
|
10
9
|
* @param sw The service worker to send the message to.
|
|
11
10
|
* @param data An object to send to the service worker.
|
package/dist/messageSW.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageSW.d.ts","sourceRoot":"","sources":["../src/messageSW.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"messageSW.d.ts","sourceRoot":"","sources":["../src/messageSW.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,OAAQ,aAAa,QAAQ,GAAG,KAAG,QAAQ,GAAG,CAQnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/window",
|
|
3
|
-
"version": "9.0.0
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Simplifies communications with Serwist packages running in the service worker",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"author": "Google's Web DevRel Team, Serwist's Team",
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"repository": "serwist/serwist",
|
|
21
|
+
"repository": "https://github.com/serwist/serwist",
|
|
22
22
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
23
23
|
"homepage": "https://serwist.pages.dev",
|
|
24
24
|
"main": "./dist/index.js",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@types/trusted-types": "2.0.7",
|
|
35
|
-
"
|
|
35
|
+
"serwist": "9.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"rollup": "4.
|
|
39
|
-
"typescript": "5.
|
|
40
|
-
"@serwist/
|
|
38
|
+
"rollup": "4.14.3",
|
|
39
|
+
"typescript": "5.5.0-dev.20240415",
|
|
40
|
+
"@serwist/configs": "9.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"typescript": ">=5.0.0"
|
package/src/Serwist.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Deferred, logger } from "
|
|
9
|
+
import { Deferred, logger } from "serwist/internal";
|
|
10
10
|
import type { TrustedScriptURL } from "trusted-types/lib";
|
|
11
11
|
|
|
12
12
|
import { messageSW } from "./messageSW.js";
|
|
@@ -255,13 +255,11 @@ export class Serwist extends SerwistEventTarget {
|
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* Sends the passed data object to the service worker registered by this
|
|
258
|
-
* instance (via
|
|
259
|
-
* with a response (if any).
|
|
258
|
+
* instance (via `getSW`) and resolves with a response (if any).
|
|
260
259
|
*
|
|
261
|
-
* A response can be
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* resolve.
|
|
260
|
+
* A response can be sent by calling `event.ports[0].postMessage(...)`, which will
|
|
261
|
+
* resolve the promise returned by `messageSW()`. If no response is sent, the promise
|
|
262
|
+
* will never resolve.
|
|
265
263
|
*
|
|
266
264
|
* @param data An object to send to the service worker
|
|
267
265
|
* @returns
|
|
@@ -273,10 +271,10 @@ export class Serwist extends SerwistEventTarget {
|
|
|
273
271
|
}
|
|
274
272
|
|
|
275
273
|
/**
|
|
276
|
-
* Sends a `{type:
|
|
277
|
-
* currently
|
|
274
|
+
* Sends a `{ type: "SKIP_WAITING" }` message to the service worker that is
|
|
275
|
+
* currently waiting and associated with the current registration.
|
|
278
276
|
*
|
|
279
|
-
* If there is no current registration or no service worker is
|
|
277
|
+
* If there is no current registration, or no service worker is waiting,
|
|
280
278
|
* calling this will have no effect.
|
|
281
279
|
*/
|
|
282
280
|
messageSkipWaiting(): void {
|
package/src/messageSW.ts
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
* Sends a data object to a service worker via `postMessage` and resolves with
|
|
11
11
|
* a response (if any).
|
|
12
12
|
*
|
|
13
|
-
* A response can be
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* resolve.
|
|
13
|
+
* A response can be sent by calling `event.ports[0].postMessage(...)`, which will
|
|
14
|
+
* resolve the promise returned by `messageSW()`. If no response is sent, the promise
|
|
15
|
+
* will never resolve.
|
|
17
16
|
*
|
|
18
17
|
* @param sw The service worker to send the message to.
|
|
19
18
|
* @param data An object to send to the service worker.
|