PageSourceSearch

https://www.aitoolsoasis.com/sw.js

js aitoolsoasis.com collected 2026-10-02 00:06:02 UTC 1,592 bytes, 52 lines download raw bytes

1const CACHE = 'app-cache-v1'
2
3self.addEventListener('install', (event) => {
4  event.waitUntil(self.skipWaiting())
5})
6
7self.addEventListener('activate', (event) => {
8  event.waitUntil(self.clients.claim())
9})
10
11self.addEventListener('fetch', () => {
12  // Network-first — non-intrusive
13})
14
15// [N-04] Web Push — show incoming notifications and open the target URL on click.
16self.addEventListener('push', (event) => {
17  let data = {}
18  try {
19    data = event.data ? event.data.json() : {}
20  } catch (e) {
21    data = { title: 'واحة أدوات الذكاء الاصطناعي', body: event.data ? event.data.text() : '' }
22  }
23
24  const title = data.title || 'واحة أدوات الذكاء الاصطناعي'
25  const options = {
26    body: data.body || '',
27    icon: data.icon || '/icon-192.png',
28    badge: data.badge || '/icon-192.png',
29    dir: 'rtl',
30    lang: data.lang || 'ar',
31    tag: data.tag || 'news',
32    data: { url: data.url || '/ar/news' },
33  }
34
35  event.waitUntil(self.registration.showNotification(title, options))
36})
37
38self.addEventListener('notificationclick', (event) => {
39  event.notification.close()
40  const url = (event.notification.data && event.notification.data.url) || '/ar/news'
41
42  event.waitUntil(
43    self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
44      for (const client of clientList) {
45        if (client.url.includes(url) && 'focus' in client) return client.focus()
46      }
47      if (self.clients.openWindow) return self.clients.openWindow(url)
48    })
49  )
50})
51
52

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.