@budarin/pluggable-serviceworker 1.5.2 → 1.5.3
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/README.md +4 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,15 +79,14 @@ pnpm add @budarin/pluggable-serviceworker
|
|
|
79
79
|
```typescript
|
|
80
80
|
// sw.js
|
|
81
81
|
import {
|
|
82
|
-
type
|
|
83
|
-
type ServiceWorkerPlugin,
|
|
82
|
+
type Plugin,
|
|
84
83
|
initServiceWorker,
|
|
85
84
|
} from '@budarin/pluggable-serviceworker';
|
|
86
85
|
|
|
87
86
|
function precacheAndServePlugin(config: {
|
|
88
87
|
cacheName: string;
|
|
89
88
|
assets: string[];
|
|
90
|
-
}):
|
|
89
|
+
}): Plugin {
|
|
91
90
|
const { cacheName, assets } = config;
|
|
92
91
|
|
|
93
92
|
return {
|
|
@@ -441,14 +440,9 @@ initServiceWorker(
|
|
|
441
440
|
Пример фабрики, которая прерывает цепочку при неавторизованном доступе к защищённым путям:
|
|
442
441
|
|
|
443
442
|
```typescript
|
|
444
|
-
import type {
|
|
445
|
-
PluginContext,
|
|
446
|
-
ServiceWorkerPlugin,
|
|
447
|
-
} from '@budarin/pluggable-serviceworker';
|
|
443
|
+
import type { Plugin } from '@budarin/pluggable-serviceworker';
|
|
448
444
|
|
|
449
|
-
function authPlugin(config: {
|
|
450
|
-
protectedPaths: string[];
|
|
451
|
-
}): ServiceWorkerPlugin<PluginContext> {
|
|
445
|
+
function authPlugin(config: { protectedPaths: string[] }): Plugin {
|
|
452
446
|
const { protectedPaths } = config;
|
|
453
447
|
|
|
454
448
|
return {
|