feat(pwa): add sw.js

This commit is contained in:
qingwei.li
2017-02-21 21:20:35 +08:00
committed by cinwell.li
parent 42b2dba589
commit f7111b5903
3 changed files with 86 additions and 3 deletions

View File

@@ -2,7 +2,6 @@ import progressbar from '../render/progressbar'
import { noop } from '../util/core'
const cache = {}
const RUN_VERSION = Date.now()
/**
* Simple ajax get
@@ -16,8 +15,6 @@ export function get (url, hasBar = false) {
xhr.addEventListener.apply(xhr, arguments)
}
url += (/\?(\w+)=/g.test(url) ? '&' : '?') + `v=${RUN_VERSION}`
if (cache[url]) {
return { then: cb => cb(cache[url]), abort: noop }
}