|
20 | 20 | <ServiceWorkerRegisterInstallableType Condition="'$(ServiceWorkerRegisterInstallableType)'==''">installable-banner</ServiceWorkerRegisterInstallableType> |
21 | 21 | <!-- The file that contains template code for the service worker "update available" --> |
22 | 22 | <ServiceWorkerRegisterInstallableTemplate Condition="'$(ServiceWorkerRegisterInstallableTemplate)' == ''">$(ServiceWorkerRegisterTemplatePath)sw_register-$(ServiceWorkerRegisterInstallableType).template.js</ServiceWorkerRegisterInstallableTemplate> |
| 23 | + <!-- Before Install Prompt handler type --> |
| 24 | + <ServiceWorkerRegisterBeforeInstallPromptType Condition="'$(ServiceWorkerRegisterBeforeInstallPromptType)'==''">beforeinstallprompt</ServiceWorkerRegisterBeforeInstallPromptType> |
| 25 | + <!-- The file that contains template code for the service worker register "beforeinstallprompt" --> |
| 26 | + <ServiceWorkerRegisterBeforeInstallPromptTemplate Condition="'$(ServiceWorkerRegisterBeforeInstallPromptTemplate)' == ''">$(ServiceWorkerRegisterTemplatePath)sw_register-$(ServiceWorkerRegisterBeforeInstallPromptType).template.js</ServiceWorkerRegisterBeforeInstallPromptTemplate> |
23 | 27 | <!-- event fired by browser when the service worker has installed ** probably never change **--> |
24 | 28 | <ServiceWorkerInstalledEvent Condition="'$(ServiceWorkerInstalledEvent)'==''">installed</ServiceWorkerInstalledEvent> |
25 | 29 | <!-- Text to display when an update is available --> |
26 | 30 | <ServiceWorkerUpdateAlertText Condition="'$(ServiceWorkerUpdateAlertText)'==''">Update available. Reload the page when convenient.</ServiceWorkerUpdateAlertText> |
| 31 | + <!-- The Blazor namespace for callbacks --> |
| 32 | + <ServiceWorkerBlazorAssembly Condition="'$(ServiceWorkerBlazorAssembly)'==''">$(ProjectName)</ServiceWorkerBlazorAssembly> |
| 33 | + <!-- The Blazor method to call when a PWA is installable --> |
| 34 | + <ServiceWorkerBlazorInstallMethod Condition="'$(ServiceWorkerBlazorInstallMethod)'==''">PWAInstallable</ServiceWorkerBlazorInstallMethod> |
27 | 35 | <!-- Setup the declarations for the Service Worker Register --> |
28 | | - <ServiceWorkerRegisterConstants Condition="'$(ServiceWorkerConstants)' == ''"> |
| 36 | + <ServiceWorkerRegisterConstants Condition="'$(ServiceWorkerRegisterConstants)' == ''"> |
29 | 37 | const serviceWorkerFileName = '$(ServiceWorkerBaseURL)$(ServiceWorkerFileName)'%3B; |
30 | 38 | const swInstalledEvent = '$(ServiceWorkerInstalledEvent)'%3B; |
31 | 39 | const staticCachePrefix = '$(ServiceWorkerCacheName)-v'%3B; |
32 | 40 | const updateAlertMessage = '$(ServiceWorkerUpdateAlertText)'%3B; |
33 | 41 | </ServiceWorkerRegisterConstants> |
| 42 | + <ServiceWorkerRegisterConstants Condition="'$(ServiceWorkerRegisterInstallableType)' == 'installable-blazor'"> |
| 43 | + $(ServiceWorkerRegisterConstants); |
| 44 | + const blazorAssembly = '$(ServiceWorkerBlazorAssembly)'%3B; |
| 45 | + const blazorInstallMethod = '$(ServiceWorkerBlazorInstallMethod)'%3B; |
| 46 | + </ServiceWorkerRegisterConstants> |
34 | 47 | </PropertyGroup> |
35 | 48 | <ItemGroup> |
36 | 49 | <!-- Read the Service Worker Register template--> |
|
45 | 58 | <ServiceWorkerRegisterTemplateLines |
46 | 59 | Condition="Exists('$(ServiceWorkerRegisterInstallableTemplate)')" |
47 | 60 | Include="$([System.IO.File]::ReadAllText($(ServiceWorkerRegisterInstallableTemplate)))"/> |
| 61 | + <!-- Read the Service Worker Register Before Install Prompt template--> |
| 62 | + <ServiceWorkerRegisterTemplateLines |
| 63 | + Condition="Exists('$(ServiceWorkerRegisterBeforeInstallPromptTemplate)')" |
| 64 | + Include="$([System.IO.File]::ReadAllText($(ServiceWorkerRegisterBeforeInstallPromptTemplate)))"/> |
48 | 65 | </ItemGroup> |
| 66 | + <!-- Debugging --> |
| 67 | + <Message |
| 68 | + Importance="high" |
| 69 | + Text="Service Worker Register Template: $(ServiceWorkerRegisterTemplate)"/> |
| 70 | + <Message |
| 71 | + Importance="high" |
| 72 | + Text="Service Worker Update Template: $(ServiceWorkerRegisterUpdateTemplate)"/> |
| 73 | + <Message |
| 74 | + Importance="high" |
| 75 | + Text="Service Worker Installable Template: $(ServiceWorkerRegisterInstallableTemplate)"/> |
| 76 | + <Message |
| 77 | + Importance="high" |
| 78 | + Text="Service Worker Before Install Prompt Template: $(ServiceWorkerRegisterBeforeInstallPromptTemplate)"/> |
49 | 79 | <!-- (Re)Create the ServiceWorkerRegister.js file --> |
50 | 80 | <WriteLinesToFile |
51 | 81 | Condition="'$(ServiceWorkerRegisterConstants)@(ServiceWorkerRegisterTemplateLines)' != ''" |
|
0 commit comments