@serwist/broadcast-update
Advanced tools
Comparing version 9.0.0-preview.10 to 9.0.0-preview.11
import type { CacheDidUpdateCallbackParam } from "@serwist/core"; | ||
import type { BroadcastCacheUpdateOptions } from "./types.js"; | ||
/** | ||
* Uses the `postMessage()` API to inform any open windows/tabs when a cached | ||
* response has been updated. | ||
* A class that uses the `postMessage()` API to inform any open windows/tabs when | ||
* a cached response has been updated. | ||
* | ||
@@ -22,6 +22,4 @@ * For efficiency's sake, the underlying response bodies are not compared; | ||
/** | ||
* Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
* and sends a message (via `postMessage()`) to all window clients if the | ||
* responses differ. Neither of the Responses can be | ||
* [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Compares two responses and sends a message (via `postMessage()`) to all window clients if the | ||
* responses differ. Neither of the Responses can be opaque. | ||
* | ||
@@ -28,0 +26,0 @@ * The message that's posted has the following format (where `payload` can |
import type { CacheDidUpdateCallbackParam, SerwistPlugin } from "@serwist/core"; | ||
import type { BroadcastCacheUpdateOptions } from "./types.js"; | ||
/** | ||
* This plugin will automatically broadcast a message whenever a cached response | ||
* is updated. | ||
* A class implementing the `cacheDidUpdate` lifecycle callback. It will automatically | ||
* broadcast a message whenever a cached response is updated. | ||
*/ | ||
@@ -7,0 +7,0 @@ export declare class BroadcastUpdatePlugin implements SerwistPlugin { |
@@ -23,3 +23,3 @@ import { SerwistError, logger, assert, resultingClientExists, timeout } from '@serwist/core/internal'; | ||
if (process.env.NODE_ENV !== "production") { | ||
logger.warn("Unable to determine where the response has been updated " + "because none of the headers that would be checked are present."); | ||
logger.warn("Unable to determine where the response has been updated because none of the headers that would be checked are present."); | ||
logger.debug("Attempting to compare the following: ", firstResponse, secondResponse, headersToCheck); | ||
@@ -26,0 +26,0 @@ } |
@@ -5,9 +5,8 @@ /** | ||
* | ||
* @param firstResponse | ||
* @param secondResponse | ||
* @param headersToCheck | ||
* @param firstResponse The first response. | ||
* @param secondResponse The second response. | ||
* @param headersToCheck A list of headers to check. | ||
* @returns | ||
*/ | ||
declare const responsesAreSame: (firstResponse: Response, secondResponse: Response, headersToCheck: string[]) => boolean; | ||
export { responsesAreSame }; | ||
export declare const responsesAreSame: (firstResponse: Response, secondResponse: Response, headersToCheck: string[]) => boolean; | ||
//# sourceMappingURL=responsesAreSame.d.ts.map |
@@ -20,3 +20,3 @@ import type { CacheDidUpdateCallbackParam } from "@serwist/core"; | ||
/** | ||
* If true (the default) then all open clients will receive a message. If false, | ||
* If `true` (the default) then all open clients will receive a message. If `false`, | ||
* then only the client that make the original request will be notified of the update. | ||
@@ -23,0 +23,0 @@ * |
{ | ||
"name": "@serwist/broadcast-update", | ||
"version": "9.0.0-preview.10", | ||
"version": "9.0.0-preview.11", | ||
"type": "module", | ||
@@ -32,3 +32,3 @@ "description": "A module that uses the Broadcast Channel API to announce when a cached response has updated", | ||
"dependencies": { | ||
"@serwist/core": "9.0.0-preview.10" | ||
"@serwist/core": "9.0.0-preview.11" | ||
}, | ||
@@ -38,3 +38,3 @@ "devDependencies": { | ||
"typescript": "5.4.0-dev.20240206", | ||
"@serwist/constants": "9.0.0-preview.10" | ||
"@serwist/constants": "9.0.0-preview.11" | ||
}, | ||
@@ -41,0 +41,0 @@ "peerDependencies": { |
@@ -1,1 +0,1 @@ | ||
This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-broadcast-update | ||
This module's documentation can be found at https://serwist.pages.dev/docs/broadcast-update |
@@ -38,4 +38,4 @@ /* | ||
/** | ||
* Uses the `postMessage()` API to inform any open windows/tabs when a cached | ||
* response has been updated. | ||
* A class that uses the `postMessage()` API to inform any open windows/tabs when | ||
* a cached response has been updated. | ||
* | ||
@@ -63,6 +63,4 @@ * For efficiency's sake, the underlying response bodies are not compared; | ||
/** | ||
* Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
* and sends a message (via `postMessage()`) to all window clients if the | ||
* responses differ. Neither of the Responses can be | ||
* [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses). | ||
* Compares two responses and sends a message (via `postMessage()`) to all window clients if the | ||
* responses differ. Neither of the Responses can be opaque. | ||
* | ||
@@ -69,0 +67,0 @@ * The message that's posted has the following format (where `payload` can |
@@ -15,4 +15,4 @@ /* | ||
/** | ||
* This plugin will automatically broadcast a message whenever a cached response | ||
* is updated. | ||
* A class implementing the `cacheDidUpdate` lifecycle callback. It will automatically | ||
* broadcast a message whenever a cached response is updated. | ||
*/ | ||
@@ -19,0 +19,0 @@ export class BroadcastUpdatePlugin implements SerwistPlugin { |
@@ -15,8 +15,8 @@ /* | ||
* | ||
* @param firstResponse | ||
* @param secondResponse | ||
* @param headersToCheck | ||
* @param firstResponse The first response. | ||
* @param secondResponse The second response. | ||
* @param headersToCheck A list of headers to check. | ||
* @returns | ||
*/ | ||
const responsesAreSame = (firstResponse: Response, secondResponse: Response, headersToCheck: string[]): boolean => { | ||
export const responsesAreSame = (firstResponse: Response, secondResponse: Response, headersToCheck: string[]): boolean => { | ||
if (process.env.NODE_ENV !== "production") { | ||
@@ -34,3 +34,3 @@ if (!(firstResponse instanceof Response && secondResponse instanceof Response)) { | ||
if (process.env.NODE_ENV !== "production") { | ||
logger.warn("Unable to determine where the response has been updated " + "because none of the headers that would be checked are present."); | ||
logger.warn("Unable to determine where the response has been updated because none of the headers that would be checked are present."); | ||
logger.debug("Attempting to compare the following: ", firstResponse, secondResponse, headersToCheck); | ||
@@ -51,3 +51,1 @@ } | ||
}; | ||
export { responsesAreSame }; |
@@ -21,3 +21,3 @@ import type { CacheDidUpdateCallbackParam } from "@serwist/core"; | ||
/** | ||
* If true (the default) then all open clients will receive a message. If false, | ||
* If `true` (the default) then all open clients will receive a message. If `false`, | ||
* then only the client that make the original request will be notified of the update. | ||
@@ -24,0 +24,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26851
526
+ Added@serwist/core@9.0.0-preview.11(transitive)
- Removed@serwist/core@9.0.0-preview.10(transitive)