PageSourceSearch

https://korplix.com/sw.js

js korplix.com collected 2026-10-03 02:35:28 UTC 1,495 bytes, 54 lines download raw bytes

1////푸시관련
2//console.log('서비스워커 로드됨...');
3//self.addEventListener('push', (e) => {
4//    const data = e.data.json();
5//    console.log(data);
6//    console.log('PUSH 받음');
7//
8//    self.registration.showNotification(data.title, {
9//        body: '푸시 테스트입니다.',
10//        icon: 'https://cdn.icon-icons.com/icons2/1482/PNG/512/22website_102116.png',
11//    });
12//});
13// 캐시 이름
14const CACHE_NAME = "cache-v1";
15
16// 캐싱할 파일
17const FILES_TO_CACHE = [
18    "/offline.html",
19    "/img/favicon-152.png"
20];
21
22// 상술한 파일 캐싱
23self.addEventListener("install", (event) => {
24    event.waitUntil(
25        caches.open(CACHE_NAME).then((cache) => cache.addAll(FILES_TO_CACHE))
26    );
27});
28
29// CACHE_NAME이 변경되면 오래된 캐시 삭제
30self.addEventListener("activate", (event) => {
31    event.waitUntil(
32        caches.keys().then((keyList) =>
33            Promise.all(
34                keyList.map((key) => {
35                    if (CACHE_NAME !== key) return caches.delete(key);
36                })
37            )
38        )
39    );
40});
41
42// 요청에 실패하면 오프라인 페이지 표시
43self.addEventListener("fetch", (event) => {
44    if ("navigate" !== event.request.mode) return;
45
46    event.respondWith(
47        fetch(event.request).catch(() =>
48            caches
49                .open(CACHE_NAME)
50                .then((cache) => cache.match("/offline.html"))
51        )
52    );
53});
54

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.