-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for CustomStrategy and Added IgnoreRoutes Option. (#71)
[release]
- Loading branch information
1 parent
69f4125
commit f67af55
Showing
9 changed files
with
131 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(function () { | ||
//Insert Your Service Worker In place of this one! | ||
|
||
// Update 'version' if you need to refresh the cache | ||
var version = '{version}'; | ||
var offlineUrl = "{offlineRoute}"; | ||
var routes = "{routes}"; | ||
var routesToIgnore = "{ignoreRoutes}"; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using Microsoft.Extensions.FileProviders; | ||
|
||
namespace WebEssentials.AspNetCore.Pwa | ||
{ | ||
/// <summary> | ||
/// A utility that can retrieve the contents of a CustomServiceworker strategy file | ||
/// </summary> | ||
public class RetrieveCustomServiceworker | ||
{ | ||
private readonly IHostingEnvironment _env; | ||
|
||
public RetrieveCustomServiceworker(IHostingEnvironment env) | ||
{ | ||
_env = env; | ||
} | ||
|
||
/// <summary> | ||
/// Returns a <seealso cref="string"/> containing the contents of a Custom Serviceworker javascript file | ||
/// </summary> | ||
/// <returns></returns> | ||
public string GetCustomServiceworker(string fileName = "customserviceworker.js") | ||
{ | ||
IFileInfo file = _env.WebRootFileProvider.GetFileInfo(fileName); | ||
return File.ReadAllText(file.PhysicalPath); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters