Spaces:
Running
Running
Download sw.js from Asem75/Islamic_clock: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/spaces/Asem75/Islamic_clock/resolve/main/sw.js
- Command line
-
hf download hf://spaces/Asem75/Islamic_clock/sw.js
-
curl -L -o sw.js https://huggingface.co/spaces/Asem75/Islamic_clock/resolve/main/sw.js
586 Bytes
| ; | |
| self.addEventListener('install',event=>event.waitUntil(self.skipWaiting())); | |
| self.addEventListener('activate',event=>event.waitUntil(self.clients.claim())); | |
| self.addEventListener('notificationclick',event=>{ | |
| event.notification.close(); | |
| const data=event.notification.data||{}; | |
| event.waitUntil((async()=>{ | |
| const windows=await self.clients.matchAll({type:'window',includeUncontrolled:true}); | |
| let client=windows.find(item=>'focus' in item); | |
| if(client)await client.focus(); | |
| else client=await self.clients.openWindow('./'); | |
| client?.postMessage(data); | |
| })()); | |
| }); | |