aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/notification/onerror/index.html
blob: 6cf9d7295df354c895a616ab141e6ef9443f29c7 (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
---
title: Notification.onerror
slug: Web/API/notification/onerror
tags:
  - Notification.onerror
translation_of: Web/API/Notification/onerror
---
<p>{{APIRef("Web Notifications")}}</p>

<h2 id="Summary" name="Summary">Summary</h2>

<p>{{domxref("Notification")}}  接口的 onerror属性指定一个事件侦听器来接收 {{event("error")}} 事件。</p>

<p>当一个 {{domxref("Notification")}} 发生错误时,会发生这些事件(在许多情况下,一个错误阻止显示通知)。</p>

<p> </p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox"><em>Notification</em>.onerror = <em>EventListener</em>;</pre>

<h3 id="Value">Value</h3>

<p>A {{jsxref("function")}} which serves as the event handler for the {{event("error")}} event. When an error occurs, the specified function will be called. If <code>null</code>, no error handler is in effect.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Web Notifications','#dom-notification-onerror','onerror')}}</td>
   <td>{{Spec2('Web Notifications')}}</td>
   <td>Initial specification.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{Page("/en-US/docs/Web/API/Notification","Browser compatibility")}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("Notification")}}</li>
 <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">Using the Notifications API</a></li>
</ul>