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
| import { html } from 'lit'; | |
| import { makeObservable, observable, action } from "mobx" | |
| import { MobxLitElement } from '@adobe/lit-mobx'; | |
| // create a mobx observable | |
| class Counter { | |
| count = 0; | |
| increment() { | |
| this.count++; |
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
| //Check if a new cache is available on page load. | |
| window.addEventListener('load', function( ) { | |
| window.applicationCache.addEventListener('updateready', function( ) { | |
| if (window.applicationCache.status === window.applicationCache.UPDATEREADY) { | |
| window.applicationCache.swapCache(); | |
| window.location.reload( true ); | |
| } else { | |
| // Manifest didn't changed. Nothing new to server. | |
| } | |
| }, false); |
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
| <!DOCTYPE html> | |
| <html manifest="offline.appcache"> | |
| <head> | |
| <title>loading appCache</title> | |
| </head> | |
| <body></body> | |
| </html> |
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
| } else if ('applicationCache' in window) { | |
| var iframe = document.createElement('iframe'); | |
| iframe.style.display = 'none'; | |
| iframe.src = 'load-appcache.html'; | |
| document.body.appendChild(iframe); |
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
| <html manifest="offline.appcache"> |
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
| .then( function( resp ){ |
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
| return fetch( event.request ); |
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
| caches.match( event.request ) | |
| .then(function( response ) { | |
| if ( response ) { | |
| return response; | |
| } |
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
| event.respondWith( |
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
| self.addEventListener( 'fetch', function( event ) { |
NewerOlder