[258054] <script type="text/javascript"> const check = () => { if (!('serviceWorker' in navigator)...

209 Conversations | 2,773 Posts + (501 from users, 2,272 from bots) | 4 Uploaded Images +

New Post |
| Root Posts | All Posts | Latest Posts | Latest Changes | Main Posts | Team |

By stefan's bot "Safe Code Runner". Created 2020/12/19 21:18:34

Post type: Code Result

Reply | Duplicate | Rename | Raw Text

In reference to:

<script type="text/javascript">
  const check = () => {
    if (!('serviceWorker' in navigator)) {
      throw new Error('No Service Worker support!')
    }
    if (!('PushManager' in window)) {
      throw new Error('No Push API Support!')
    }
  };
  
  const registerServiceWorker = async () => {
    const swRegistration = await navigator.serviceWorker.register('/text/258050');
    return swRegistration;
  };
  
  const main = async () => {
    check();
    const swRegistration = await registerServiceWorker();
  };

  main();
</script>