Skip to Content
만들면서 배우는 프로그레시브 웹 앱: 사용자 경험을 극대화하는 차세대 웹 앱 기술
book

만들면서 배우는 프로그레시브 웹 앱: 사용자 경험을 극대화하는 차세대 웹 앱 기술

by 한민주, 양찬석, 탈 아터
April 2019
Beginner to intermediate
368 pages
7h 18m
Korean
Hanbit Media, Inc.
Content preview from 만들면서 배우는 프로그레시브 웹 앱: 사용자 경험을 극대화하는 차세대 웹 앱 기술
246 - 프로그레시브 웹 앱
self
.
addEventListener
("
message
",
function
(
messageEvent
)
{
var openPort
=
messageEvent
.
ports
[
0
];
self
.
addEventListener
("
fetch
",
function
(
fetchEvent
)
{
openPort
.
postMessage
(
fetchEvent
.
request
.
url
);
});
});
이 예제의 윈도우 코드는 앞선 예제와 아주 유사합니다. 새
MessageChannel
을
생성한 다음 하나의 포트를 통해 메시지를 수신하고, 다른 포트는 메시지와 함께
서비스 워커에 전달합니다. 유일한 차이점은 메시지의 내용입니다.
서비스 워커가 이 메시지를 수신하면
fetch
이벤트 리스너를 하나 추가합니다.
이 이벤트 리스너는
fetch
이벤트가 발생하면 열려 있는 포트를 통하여 네트워크
요청
URL
을 메시지로 전달합니다.
그 결과 해당 페이지에는 서비스 워커에서 생성된 모든 네트워크 요청
(
현재 탭뿐만
아니라, 서비스 워커가 제어하는 다른 윈도우에서도 발생하는
)
URL
이 지속적으로 출력됩니
다. 이 파일 이름을
network
.
html
로 정하고, 다른 탭에서 여러분의 사이트를 탐
색해보세요. 당신만의 브라우저 개발 도구를 만드는 데 한 걸음 나아간 것입니다.
8.5 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

파이썬으로 웹 크롤러 만들기: 초간단 나만의 웹 크롤러로 원하는 데이터 가져오는 방법

파이썬으로 웹 크롤러 만들기: 초간단 나만의 웹 크롤러로 원하는 데이터 가져오는 방법

한선용, 라이언 미첼

Publisher Resources

ISBN: 9791162248737