From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/pushmanager/index.html | 111 ++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 files/ko/web/api/pushmanager/index.html (limited to 'files/ko/web/api/pushmanager') diff --git a/files/ko/web/api/pushmanager/index.html b/files/ko/web/api/pushmanager/index.html new file mode 100644 index 0000000000..f42fb127ab --- /dev/null +++ b/files/ko/web/api/pushmanager/index.html @@ -0,0 +1,111 @@ +--- +title: PushManager +slug: Web/API/PushManager +tags: + - API + - Experimental + - Interface + - Push + - Push API + - Reference + - Service Workers + - 푸시 + - 푸시 알림 +translation_of: Web/API/PushManager +--- +

{{ApiRef("Push API")}}

+ +

Push APIPushManager 인터페이스는 서드파티 서버에서 알림을 수신하거나, URL에 푸시 알림을 요청하는 방법을 제공합니다.

+ +

PushManager는 {{domxref("ServiceWorkerRegistration.pushManager")}} 속성으로 접근할 수 있습니다.

+ +

속성

+ +
+
{{domxref("PushManager.supportedContentEncodings")}}
+
푸시 메시지의 페이로드를 암호화할 때 지원하는 콘텐츠 인코딩의 목록을 반환합니다.
+
+ +

메서드

+ +
+
{{domxref("PushManager.getSubscription()")}}
+
기존의 푸시 구독을 가져옵니다. 해당 구독에 대한 상세 정보를 담은 {{domxref("PushSubscription")}} 객체를 {{jsxref("Promise")}}로 반환합니다. 구독이 존재하지 않으면 프로미스는 null로 이행합니다.
+
{{domxref("PushManager.permissionState()")}}
+
PushManager의 허가 상태로 이행하는 {{jsxref("Promise")}}를 반환합니다. 상태는 'granted', 'denied', 'prompt' 중 하나입니다.
+
{{domxref("PushManager.subscribe()")}}
+
푸시 서비스에 구독합니다. 해당 구독에 대한 상세 정보를 담은 {{domxref("PushSubscription")}} 객체를 {{jsxref("Promise")}}로 반환합니다. 현재 서비스 워커에 이전 구독이 존재하지 않으면 새로운 푸시 구독을 생성합니다.
+
+ + + +

예제

+ +
this.onpush = function(event) {
+  console.log(event.data);
+  // From here we can write the data to IndexedDB, send it to any open
+  // windows, display a notification, etc.
+}
+
+navigator.serviceWorker.register('serviceworker.js').then(
+  function(serviceWorkerRegistration) {
+    serviceWorkerRegistration.pushManager.subscribe().then(
+      function(pushSubscription) {
+        console.log(pushSubscription.endpoint);
+        // The push subscription details needed by the application
+        // server are now available, and can be sent to it using,
+        // for example, an XMLHttpRequest.
+      }, function(error) {
+        // During development it often helps to log errors to the
+        // console. In a production environment it might make sense to
+        // also report information about errors back to the
+        // application server.
+        console.log(error);
+      }
+    );
+  });
+ +

명세

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Push API','#pushmanager-interface','PushManager')}}{{Spec2('Push API')}}Initial definition.
+ +

브라우저 호환성

+ +
+ + +

{{Compat("api.PushManager")}}

+
+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf