PageSourceSearch

https://oqoq.ai/serviceworker.js

js oqoq.ai collected 2026-10-05 13:49:24 UTC 1,942 bytes, 46 lines download raw bytes

1//push 이벤트 처리이다. 여기서는 간단하게 메시지, icon 처리정도만 해주었다.
2self.addEventListener("push", (event) => {
3    // event는 서버에서 payload로 보내준 데이터이다.
4    let { title, body, icon, tag, sound } = JSON.parse(event.data && event.data.text());
5
6    const options = {
7        body: body,
8        icon: icon,
9        tag: tag,
10        sound: sound  // 사운드 파일 경로
11        // sound: "https://www.oqoq.ai/videos/oq_order.mp3"  // 사운드 파일 경로
12    };
13
14    event.waitUntil(
15        self.registration.showNotification(title || "", options)
16    );
17    // 이외에도 여러 옵션이 있다.
18    // 참고: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification
19    // event.waitUntil(
20    //     self.registration.showNotification(title || "", { body, tag, icon })
21    // );
22});
23
24//알림 클릭시 작업이다.
25self.addEventListener("notificationclick", function (event) {
26    event.notification.close();
27    const urlToOpen = "http://oqoq.ai/main/tab/order";
28    event.waitUntil(
29        self.clients
30            .matchAll({
31                type: "window",
32                includeUncontrolled: true,
33                // 현재 서비스워커 클라이언트와 동일한 origin의 클라이언트를 포함시킬지 여부.
34                // 요걸 활성화해두지 않으면, 현재 열린 탭이 있더라도 서비스워커를 활성화시킨 탭이 아니면 client에 포함되지 않음
35            })
36            .then(function (clientList) {
37                // if (clientList.length > 0) {
38                //     // 이미 열려있는 탭이 있는 경우
39                //     return clientList[0]
40                //         .focus()
41                //         .then((client) => client.navigate(urlToOpen));
42                // }
43                return self.clients.openWindow(urlToOpen);
44            })
45    );
46});

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.