forked from GoogleChromeLabs/squoosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw-bridge.894ac.js
137 lines (137 loc) · 4.45 KB
/
sw-bridge.894ac.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
(self.webpackJsonp = self.webpackJsonp || []).push([
[0],
{
54: function (e, t, n) {
'use strict';
n.d(t, 'a', function () {
return o;
}),
n.d(t, 'b', function () {
return s;
});
class r {
constructor(e = 'keyval-store', t = 'keyval') {
(this.storeName = t),
(this._dbp = new Promise((n, r) => {
const a = indexedDB.open(e, 1);
(a.onerror = () => r(a.error)),
(a.onsuccess = () => n(a.result)),
(a.onupgradeneeded = () => {
a.result.createObjectStore(t);
});
}));
}
_withIDBStore(e, t) {
return this._dbp.then(
(n) =>
new Promise((r, a) => {
const i = n.transaction(this.storeName, e);
(i.oncomplete = () => r()),
(i.onabort = i.onerror = () => a(i.error)),
t(i.objectStore(this.storeName));
}),
);
}
}
let a;
function i() {
return a || (a = new r()), a;
}
function o(e, t = i()) {
let n;
return t
._withIDBStore('readonly', (t) => {
n = t.get(e);
})
.then(() => n.result);
}
function s(e, t, n = i()) {
return n._withIDBStore('readwrite', (n) => {
n.put(t, e);
});
}
},
56: function (e, t, n) {
'use strict';
n.r(t),
function (e) {
n.d(t, 'getSharedImage', function () {
return i;
}),
n.d(t, 'offliner', function () {
return o;
}),
n.d(t, 'mainAppLoaded', function () {
return s;
});
var r = n(54);
async function a(e) {
if (e.waiting) return;
const t = await (async function (e) {
return e.installing
? e.installing
: new Promise((t) => {
e.addEventListener('updatefound', () => t(e.installing), {
once: !0,
});
});
})(e);
return new Promise((e) => {
t.addEventListener('statechange', () => {
'installed' === t.state && e();
});
});
}
function i() {
return new Promise((e) => {
const t = (n) => {
'load-image' === n.data.action &&
(e(n.data.file),
navigator.serviceWorker.removeEventListener('message', t));
};
navigator.serviceWorker.addEventListener('message', t),
navigator.serviceWorker.controller.postMessage('share-ready');
});
}
async function o(t) {
if ('boolean' == typeof PRERENDER) return;
navigator.serviceWorker.register(e);
const n = !!navigator.serviceWorker.controller;
if (
(navigator.serviceWorker.addEventListener(
'controllerchange',
async () => {
n
? location.reload()
: t('ഓഫ്ലൈനിൽ പ്രവർത്തിക്കാൻ തയ്യാറാണ്', { timeout: 5e3 });
},
),
!n)
)
return;
const r = await navigator.serviceWorker.getRegistration();
r &&
(await a(r),
'reload' ===
(await t('അപ്ഡേറ്റ് ലഭ്യമാണ്', {
actions: ['reload', 'dismiss'],
})) &&
(async function () {
const e = await navigator.serviceWorker.getRegistration();
e && e.waiting && e.waiting.postMessage('skip-waiting');
})());
}
async function s() {
if (await Object(r.a)('user-interacted')) return;
Object(r.b)('user-interacted', !0);
const e = await (async function () {
const e = await navigator.serviceWorker.getRegistration();
return e ? e.active || e.waiting || e.installing : null;
})();
e && e.postMessage('cache-all');
}
}.call(this, n.p + 'serviceworker.js');
},
},
]);
//# sourceMappingURL=sw-bridge.894ac.js.map