OLD | NEW |
---|---|
1 <p> | 1 <p> |
2 An <code>Event</code> is an object | 2 An <code>Event</code> is an object |
3 that allows you to be notified | 3 that allows you to be notified |
4 when something interesting happens. | 4 when something interesting happens. |
5 Here's an example of using the | 5 Here's an example of using the |
6 <code>chrome.alarms.onAlarm</code> event | 6 <code>chrome.alarms.onAlarm</code> event |
7 to be notified whenever an alarm has elapsed: | 7 to be notified whenever an alarm has elapsed: |
8 </p> | 8 </p> |
9 | 9 |
10 <pre> | 10 <pre> |
(...skipping 11 matching lines...) Expand all Loading... | |
22 is always a function that you define to handle the event, | 22 is always a function that you define to handle the event, |
23 but the parameters to the function depend on | 23 but the parameters to the function depend on |
24 which event you're handling. | 24 which event you're handling. |
25 Checking the documentation for | 25 Checking the documentation for |
26 $ref:alarms.onAlarm, | 26 $ref:alarms.onAlarm, |
27 you can see that the function has a single parameter: | 27 you can see that the function has a single parameter: |
28 an $ref:alarms.Alarm object | 28 an $ref:alarms.Alarm object |
29 that has details about the elapsed alarm. | 29 that has details about the elapsed alarm. |
30 </p> | 30 </p> |
31 | 31 |
32 Example APIs using Events: | |
33 <a href="alarms.html">alarms</a>, | |
rpaquay
2014/01/10 23:50:46
nit: I think you can use $ref:alarms (same remark
scheib
2014/01/10 23:58:31
Done.
| |
34 {{?is_apps}} | |
35 <a href="app.runtime.html">app.runtime</a>, | |
36 <a href="app.window.html">app.window</a>, | |
37 {{/is_apps}} | |
38 <a href="i18n.html">i18n</a>, | |
39 <a href="identity.html">identity</a>, | |
40 <a href="runtime.html">runtime</a>. Most <a href="api_index.html">chrome APIs</a > do. | |
32 | 41 |
33 {{^is_apps}} | 42 {{^is_apps}} |
34 <div class="doc-family extensions"> | 43 <div class="doc-family extensions"> |
35 <h2 id="declarative">Declarative Event Handlers</h2> | 44 <h2 id="declarative">Declarative Event Handlers</h2> |
36 | 45 |
37 <p> | 46 <p> |
38 The declarative event handlers provide a means to define rules consisting of | 47 The declarative event handlers provide a means to define rules consisting of |
39 declarative conditions and actions. Conditions are evaluated in the browser | 48 declarative conditions and actions. Conditions are evaluated in the browser |
40 rather than the JavaScript engine which reduces roundtrip latencies and allows | 49 rather than the JavaScript engine which reduces roundtrip latencies and allows |
41 for very high efficiency. | 50 for very high efficiency. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 of filters that an event supports will be listed in the documentation for that | 263 of filters that an event supports will be listed in the documentation for that |
255 event in the "filters" section.</p> | 264 event in the "filters" section.</p> |
256 | 265 |
257 <p>When matching URLs (as in the example above), event filters support the same | 266 <p>When matching URLs (as in the example above), event filters support the same |
258 URL matching capabilities as expressible with a | 267 URL matching capabilities as expressible with a |
259 $ref:events.UrlFilter, except for scheme and port | 268 $ref:events.UrlFilter, except for scheme and port |
260 matching.</p> | 269 matching.</p> |
261 | 270 |
262 </div> | 271 </div> |
263 {{/is_apps}} | 272 {{/is_apps}} |
OLD | NEW |