blob: b8d32436e59664426481a248ceb5f98ffb69b6a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
---
title: PushManager.register()
slug: Web/API/PushManager/register
tags:
- API
- Deprecated
- Method
- Reference
- Simple Push API
- メソッド
translation_of: Web/API/PushManager/register
---
<div>{{deprecated_header}}{{ ApiRef("Push API")}}</div>
<p><strong><code>register</code></strong> メソッドは、システムにプッシュ通知の新しい端点をリクエストするために使用します。このメソッドは {{domxref("PushManager.subscribe()")}} に置き換えられました。</p>
<h2 id="Syntax" name="Syntax">構文</h2>
<pre class="syntaxbox">var request = navigator.push.register();</pre>
<h3 id="Return" name="Return">返値</h3>
<p>{{domxref("DOMRequest")}} オブジェクトで、このメソッド呼び出しの成功または失敗を扱います。</p>
<p>メソッドの呼び出しに成功したら、リクエストの <code>result</code> が端点の URL を表す文字列になります。</p>
<div class="note">
<p><strong>メモ:</strong> この URL が必要なくなったら、 {{domxref("Pushmanager.unregister()")}} を使用して自分自身を掃除してください。</p>
</div>
<h2 id="Example" name="Example">例</h2>
<pre class="brush: js">var req = navigator.push.register();
req.onsuccess = function(e) {
var endpoint = req.result;
debug("New endpoint: " + endpoint );
}
req.onerror = function(e) {
debug("Error getting a new endpoint: " + JSON.stringify(e));
}
</pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
<th scope="col">状態</th>
<th scope="col">備考</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('Push API')}}</td>
<td>{{Spec2('Push API')}}</td>
<td><code>PushManager</code> インターフェイスを定義</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<div>
<p>{{Compat("api.PushManager.register")}}</p>
</div>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{domxref("PushManager")}}</li>
<li>{{domxref("DOMRequest")}}</li>
</ul>
|