UNPKG

@matolink/next-offline-ts

Version:

<h1 align="center"> next-offline-ts </h1>

14 lines (13 loc) 510 B
"use strict"; if (typeof window != 'undefined' && 'serviceWorker' in navigator) { window.addEventListener('load', function () { navigator.serviceWorker .register('{REGISTER_SW_PREFIX}/service-worker.js', { scope: '{SW_SCOPE}' }) .then(function (registration) { console.log('SW registered: ', registration); }) .catch(function (registrationError) { console.log('SW registration failed: ', registrationError); }); }); }