File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < head >
3
+ < meta charset ="UTF-8 " />
4
+ < title > Hello World</ title >
5
+ < link rel ="stylesheet " href ="test.css " />
6
+ </ head >
7
+ < body >
8
+ < header >
9
+ TEST HEADER
10
+ </ header >
11
+ < div id ="main "> </ div >
12
+ < script src ="test.js "> </ script >
13
+ < script >
14
+ if ( 'serviceWorker' in navigator ) {
15
+ window . addEventListener ( 'load' , function ( ) {
16
+ navigator . serviceWorker . register ( './registerServiceWorker.js' ) . then ( function ( registration ) {
17
+ console . log ( "서비스 워커 등록 완료" , registration . scope ) ;
18
+ } ) . catch ( function ( err ) {
19
+ console . log ( "서비스 워커 등록 실패" , err ) ;
20
+ } )
21
+ } )
22
+ }
23
+ </ script >
24
+ </ body >
25
+ </ html>
Original file line number Diff line number Diff line change
1
+ const CACHE_NAME = "test-cashe-1" ;
2
+
3
+ const urlsToCache = [
4
+ '/pwa/' ,
5
+ '/pwa/test.css' ,
6
+ '/pwa/test.js'
7
+ ]
8
+
9
+ self . addEventListener ( 'install' , function ( event ) {
10
+ event . waitUntil (
11
+ caches . open ( CHCHE_NAME )
12
+ . then ( function ( cache ) {
13
+ console . log ( "CACHE 등록 완료" ) ;
14
+ return cache . addAll ( urlsToCache ) ;
15
+ } )
16
+ ) ;
17
+ } )
Original file line number Diff line number Diff line change
1
+ # main ::after {
2
+ content : "CSS is ON" ;
3
+ display : block;
4
+ color : white;
5
+ }
Original file line number Diff line number Diff line change
1
+ const main = document . querySelector ( "#main" ) ;
2
+
3
+ main . innerHTML = "이것이 보인다면 스크립트가 정상적으로 로딩된 것입니다" ;
You can’t perform that action at this time.
0 commit comments