This file contains hidden or 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
    
  
  
    
  | error_page 404 = @notfound; | |
| location @notfound { | |
| set $lang "sv"; | |
| if ($uri ~ "^/([a-z]{2})/(.*)$") { | |
| set $lang $1; | |
| } | |
| rewrite ^ "/$lang/404/" break; | |
| } | |
| location / { | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const logMsg = (msg) => { | |
| if('<%= app.config[:environment] %>' == 'development') { | |
| console.log(msg); | |
| } | |
| }; | |
| // ... | |
| logMsg('Install event'); | |
| // ... | |
| logMsg('Activate event'); | |
| // etc. | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const appLangs = ['<%= app.extensions[:i18n].options.langs.join("','") %>']; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const criticalResources = [ | |
| '<%= asset_path :css, "/#{app.config[:css_dir]}/application" %>', | |
| '<%= asset_path :js, "/#{app.config[:js_dir]}/application" %>', | |
| '<%= asset_path :images, "logo.svg" %>' | |
| ]; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | function update_sw_version() { | |
| // writes serviceworker.js file with a new value for "version" variable | |
| } | |
| add_action('save_post', 'update_sw_version'); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const appLangs = ['en', 'sv'], | |
| url = new URL(event.request.url); | |
| event.respondWith( | |
| fetch(event.request).then(response => { | |
| // ... | |
| return response; | |
| }) | |
| .catch(function() { | |
| let lang = url.pathname.substr(1, 2); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | const criticalResources = [ | |
| '/sv/', | |
| '/en/', | |
| '/sv/offline/', | |
| '/en/offline/', | |
| ], | |
| otherResources = [ | |
| '/sv/projekt/', | |
| '/sv/om/', | |
| '/sv/kollegor/', | 
  
    
      This file contains hidden or 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
    
  
  
    
  | server { | |
| location ~* (serviceworker\.js)$ { | |
| add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | |
| expires off; | |
| proxy_no_cache 1; | |
| } | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | <Files serviceworker.js> | |
| FileETag None | |
| Header unset ETag | |
| Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" | |
| Header set Pragma "no-cache" | |
| Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" | |
| </Files> | 
  
    
      This file contains hidden or 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
    
  
  
    
  | var thirdPartyExceptions = [ | |
| 'https://code.jquery.com/jquery.min.js' | |
| ]; | |
| // ... | |
| event.respondWith(fetch(request).then(response => { // network | |
| // cache only resources from this domain as well as the exceptions | |
| if(location.origin === url.origin || | |
| thirdPartyExceptions.includes(url.href)) { | |
| // addToCache use | |
| } | 
NewerOlder