PWA Feature Detector



((a, b, c) =>{
const d = (d) =>({
'Offline Capabilities': 'caches' in a,
'Push Notifications': 'pushManager' in d,
'Add to Home Screen': b.createElement('link').relList.supports('manifest'),
'Background Sync': 'sync' in d,
'Navigation Preload': 'navigationPreload' in d,
'Silent Push': 'budget' in c && 'reserve' in c.budget,
'Storage Estimation': 'storage' in c && 'estimate' in c.storage,
'Persistent Storage': 'storage' in c && 'persist' in c.storage,
'Web Share': 'share' in c,
'Media Session': 'mediaSession' in c,
'Media Capabilities': 'mediaCapabilities' in c,
'Device Memory': 'deviceMemory' in c,
'Getting Installed Related Apps': 'getInstalledRelatedApps' in c,
'Payment Request': 'PaymentRequest' in a,
'Credential Management': 'credentials' in c
}),
e = (a) =>{
const c = b.createDocumentFragment(),
d = b.getElementById('featureRow'),
e = d.content.querySelector('.feature'),
f = d.content.querySelector('.support');
for (let g in a) a.hasOwnProperty(g) && (e.textContent = g, f.textContent = a[g] ? '✅' : '❌', c.appendChild(b.importNode(d.content, !0)));
const g = b.getElementById('placeholder');
g.parentNode.replaceChild(c, g)
};
a.addEventListener('load', () =>{
b.getElementById('userAgent').textContent = c.userAgent,
a.setTimeout(() =>'serviceWorker' in c ? c.serviceWorker.register('sw.min.js').then((a) =>{
const b = d(a);
e(b)
}) : void e({
'Service Workers Not Supported': !1
}), 500)
})
}) (window, document, navigator);