From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/pushsubscription/unsubscribe/index.html | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 files/ja/web/api/pushsubscription/unsubscribe/index.html (limited to 'files/ja/web/api/pushsubscription/unsubscribe') diff --git a/files/ja/web/api/pushsubscription/unsubscribe/index.html b/files/ja/web/api/pushsubscription/unsubscribe/index.html new file mode 100644 index 0000000000..3e73b98e19 --- /dev/null +++ b/files/ja/web/api/pushsubscription/unsubscribe/index.html @@ -0,0 +1,127 @@ +--- +title: PushSubscription.unsubscribe() +slug: Web/API/PushSubscription/unsubscribe +tags: + - API + - Experimental + - Method + - Push + - Push API + - PushSubscription + - Reference + - Service Workers + - unsubscribe +translation_of: Web/API/PushSubscription/unsubscribe +--- +

{{SeeCompatTable}}{{APIRef("Push API")}}

+ +

{{domxref("PushSubscription")}} インターフェースの unsubscribe() メソッドは、現在のサブスクリプションが成功裏に登録解除されたときに {{domxref("Boolean")}} で解決される{{domxref("Promise")}} を返します。

+ +

構文

+ +
​PushSubscription.unsubscribe().then(function(Boolean) { ... });
+ +

パラメーター

+ +

なし。

+ +

戻り値

+ +

現在のサブスクリプションが成功裏に登録解除されたときに {{domxref("Boolean")}} で解決される{{domxref("Promise")}}。

+ +

+ +
navigator.serviceWorker.ready.then(function(reg) {
+  reg.pushManager.getSubscription().then(function(subscription) {
+    subscription.unsubscribe().then(function(successful) {
+      // 登録解除が成功
+    }).catch(function(e) {
+      // 登録解除が失敗
+    })
+  })
+});
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Push API','#widl-PushSubscription-unsubscribe-Promise-boolean','unsubscribe()')}}{{Spec2('Push API')}}初期定義。
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本サポート{{CompatChrome(42.0)}}{{CompatGeckoDesktop(44.0)}}[1]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
機能AndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
基本サポート{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(48)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatChrome(42.0)}}
+
+ + + +

関連項目

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