You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -263,6 +263,32 @@ This strategy will always try the network first for all resources and then fall
263
263
264
264
This strategy is completely safe to use and is primarily useful for offline-only scenarios since it isn't giving any performance benefits.
265
265
266
+
### CustomStrategy
267
+
This strategy will allow the user to specify their own implementation as a Javascript(.js) file. By default the app will search for a file named `customserviceworker.js` in the wwwroot folder.
268
+
A filename may be explicitly set by providing it as an option when registering the service in the `Startup.cs` or `appsettings.json` file.
When creating the `customserviceworker.js` by providing {version}, {routes}, {ignoreRoutes} and {offlineRoute} values within the javascript file string, interpolation will be used to replace these values with option values as set in the `Startup.cs` or `appsettings.json` file.
279
+
280
+
```javascript
281
+
(function () {
282
+
//Insert Your Service Worker In place of this one!
283
+
284
+
// Update 'version' if you need to refresh the cache
285
+
var version ='{version}';
286
+
var offlineUrl ="{offlineRoute}";
287
+
var routes ="{routes}";
288
+
var routesToIgnore ="{ignoreRoutes}";
289
+
});
290
+
```
291
+
266
292
## .Net Core Application hosted as Virtual Directory
267
293
You can now specify a specific BaseURL if you plan to host your application as a Virtual Directory in IIS:
268
294
@@ -322,4 +348,4 @@ Make sure to update your `wwwroot/manifest.json` file:
0 commit comments