|
26 | 26 | <ServiceWorkerRegisterTemplatePath Condition="'$(ServiceWorkerRegisterTemplatePath)' == ''">$(MSBuildThisFileDirectory)..\Templates\ServiceWorker\</ServiceWorkerRegisterTemplatePath>
|
27 | 27 | <!-- The file that contains template code for the service worker register file -->
|
28 | 28 | <ServiceWorkerRegisterTemplate Condition="'$(ServiceWorkerRegisterTemplate)' == ''">$(ServiceWorkerRegisterTemplatePath)sw_register.template.js</ServiceWorkerRegisterTemplate>
|
| 29 | + <!-- The file that contains template code for the service worker "update available" --> |
| 30 | + <ServiceWorkerRegisterUpdateNotificationTemplate Condition="'$(ServiceWorkerRegisterUpdateNotificationTemplate)' == ''">$(ServiceWorkerRegisterTemplatePath)sw_register-update-alert.template.js</ServiceWorkerRegisterUpdateNotificationTemplate> |
29 | 31 | </PropertyGroup>
|
30 | 32 |
|
31 | 33 | <PropertyGroup Label="Implementation">
|
32 | 34 | <!-- event fired by browser when the service worker has installed ** probably never change **-->
|
33 | 35 | <ServiceWorkerInstalledEvent Condition="'$(ServiceWorkerInstalledEvent)'==''">installed</ServiceWorkerInstalledEvent>
|
| 36 | + <!-- Text to display when an update is available --> |
| 37 | + <ServiceWorkerUpdateAlertText Condition="'$(ServiceWorkerUpdateAlertText)'==''">Update available. Reload the page when convenient.</ServiceWorkerUpdateAlertText> |
| 38 | + <!-- Update available alert type --> |
| 39 | + <ServiceWorkerUpdateNotificationType Condition="'$(ServiceWorkerUpdateNotificationType)'==''">update-alert</ServiceWorkerUpdateNotificationType> |
34 | 40 | <!-- Setup the declarations for the Service Worker Register -->
|
35 | 41 | <ServiceWorkerRegisterConstants Condition="'$(ServiceWorkerConstants)' == ''">
|
36 | 42 | const serviceWorkerFileName = '$(ServiceWorkerBaseURL)$(ServiceWorkerFileName)'%3B;
|
37 | 43 | const swInstalledEvent = '$(ServiceWorkerInstalledEvent)'%3B;
|
38 | 44 | const staticCachePrefix = '$(ServiceWorkerCacheName)-v'%3B;
|
| 45 | + const updateAlertMessage = '$(ServiceWorkerUpdateAlertText)'%3B; |
39 | 46 | </ServiceWorkerRegisterConstants>
|
40 | 47 | </PropertyGroup>
|
41 | 48 | <ItemGroup>
|
42 | 49 | <ServiceWorkerRegisterTemplateLines Include="$([System.IO.File]::ReadAllText($(ServiceWorkerRegisterTemplate)))"/>
|
| 50 | + <ServiceWorkerRegisterTemplateLines Include="$([System.IO.File]::ReadAllText($(ServiceWorkerRegisterUpdateNotificationTemplate)))"/> |
43 | 51 | </ItemGroup>
|
44 | 52 | <WriteLinesToFile
|
45 | 53 | File="$(WWWRoot)$(ServiceWorkerRegisterFileName)"
|
|
0 commit comments