Added service worker

This commit is contained in:
2017-07-14 00:11:25 +02:00
parent 3740ec61d6
commit 1a5cd8494e
4 changed files with 121 additions and 22 deletions

View File

@ -13,6 +13,7 @@ export class Application {
loading: HTMLElement
currentPath: string
originalPath: string
eTag: string
lastRequest: XMLHttpRequest
constructor() {
@ -45,6 +46,8 @@ export class Application {
request.onerror = () => reject(new Error("You are either offline or the requested page doesn't exist."))
request.ontimeout = () => reject(new Error("The page took too much time to respond."))
request.onload = () => {
this.eTag = request.getResponseHeader("ETag")
if(request.status < 200 || request.status >= 400)
reject(request.responseText)
else