-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpwa.min.js
51 lines (51 loc) · 1.48 KB
/
pwa.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! UpUp
//! version : 1.0.0
//! author : Tal Ater @TalAter
//! license : MIT
//! https://github.com/TalAter/UpUp
(function(e) {
'use strict';
var t = navigator.serviceWorker;
if (!t) return (this.UpUp = null), e;
var n = { 'service-worker-url': 'service-worker.js' },
r = !1,
s = 'font-weight: bold; color: #00f;';
this.UpUp = {
start: function(e) {
this.addSettings(e),
t
.register(n['service-worker-url'], { scope: './' })
.then(function(e) {
r &&
console.log(
'Service worker registration successful with scope: %c' +
e.scope,
s
);
(e.installing || t.controller || e.active).postMessage({
action: 'set-settings',
settings: n
});
})
.catch(function(e) {
r && console.log('Service worker registration failed: %c' + e, s);
});
},
addSettings: function(t) {
'string' == typeof (t = t || {}) && (t = { content: t }),
[
'content',
'content-url',
'assets',
'service-worker-url',
'cache-version'
].forEach(function(r) {
t[r] !== e && (n[r] = t[r]);
});
},
debug: function(e) {
r = !(arguments.length > 0) || !!e;
}
};
}.call(this));
//# sourceMappingURL=upup.min.js.map