1. 개발자를 위한 웹 기술
  2. Web API
  3. PushSubscription
  4. unsubscribe()

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

PushSubscription: unsubscribe() 메서드

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2023년 3월.

보안 컨텍스트: 이 기능은 일부 또는 모든 지원 브라우저보안 컨텍스트 (HTTPS)에서만 사용할 수 있습니다.

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

PushSubscription 인터페이스의 unsubscribe() 메서드는 현재 구독이 성공적으로 구독 취소될 때 불리언 값으로 이행되는 Promise를 반환합니다.

구문

js
unsubscribe()

매개변수

없음.

반환 값

현재 구독이 성공적으로 구독 취소될 때 불리언 값으로 이행되는 Promise.

예제

js
navigator.serviceWorker.ready.then((reg) => {
 reg.pushManager.getSubscription().then((subscription) => {
 subscription
 .unsubscribe()
 .then((successful) => {
 // 성공적으로 구독을 취소했습니다
 })
 .catch((e) => {
 // 구독 취소에 실패했습니다
 });
 });
});

명세서

Specification
Push API
# dom-pushsubscription-unsubscribe

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /