Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/common/extensions/docs/templates/intros/events.html

Issue 219213007: Remove .html extension from links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
31 31
32 Example APIs using Events: 32 Example APIs using Events:
33 $(ref:alarms), 33 $(ref:alarms),
34 {{?is_apps}} 34 {{?is_apps}}
35 $(ref:app.runtime), 35 $(ref:app.runtime),
36 $(ref:app.window), 36 $(ref:app.window),
37 {{/is_apps}} 37 {{/is_apps}}
38 $(ref:i18n), 38 $(ref:i18n),
39 $(ref:identity), 39 $(ref:identity),
40 $(ref:runtime). 40 $(ref:runtime).
41 Most <a href="api_index.html">chrome APIs</a> do. 41 Most <a href="api_index">chrome APIs</a> do.
42 42
43 {{^is_apps}} 43 {{^is_apps}}
44 <div class="doc-family extensions"> 44 <div class="doc-family extensions">
45 <h2 id="declarative">Declarative Event Handlers</h2> 45 <h2 id="declarative">Declarative Event Handlers</h2>
46 46
47 <p> 47 <p>
48 The declarative event handlers provide a means to define rules consisting of 48 The declarative event handlers provide a means to define rules consisting of
49 declarative conditions and actions. Conditions are evaluated in the browser 49 declarative conditions and actions. Conditions are evaluated in the browser
50 rather than the JavaScript engine which reduces roundtrip latencies and allows 50 rather than the JavaScript engine which reduces roundtrip latencies and allows
51 for very high efficiency. 51 for very high efficiency.
52 </p> 52 </p>
53 53
54 <p>Declarative event handlers are used for example in the <a 54 <p>Declarative event handlers are used for example in the <a
55 href="declarativeWebRequest.html">Declarative Web Request API</a> and <a 55 href="declarativeWebRequest">Declarative Web Request API</a> and <a
56 href="declarativeContent.html">Declarative Content API</a>. This page describes 56 href="declarativeContent">Declarative Content API</a>. This page describes
57 the underlying concepts of all declarative event handlers. 57 the underlying concepts of all declarative event handlers.
58 </p> 58 </p>
59 59
60 <h3 id="rules">Rules</h3> 60 <h3 id="rules">Rules</h3>
61 61
62 <p>The simplest possible rule consists of one or more conditions and one or more 62 <p>The simplest possible rule consists of one or more conditions and one or more
63 actions:</p> 63 actions:</p>
64 <pre> 64 <pre>
65 var rule = { 65 var rule = {
66 conditions: [ /* my conditions */ ], 66 conditions: [ /* my conditions */ ],
(...skipping 14 matching lines...) Expand all
81 id: "my rule", // optional, will be generated if not set. 81 id: "my rule", // optional, will be generated if not set.
82 priority: 100, // optional, defaults to 100. 82 priority: 100, // optional, defaults to 100.
83 conditions: [ /* my conditions */ ], 83 conditions: [ /* my conditions */ ],
84 actions: [ /* my actions */ ] 84 actions: [ /* my actions */ ]
85 }; 85 };
86 </pre> 86 </pre>
87 87
88 <h3 id="eventobjects">Event objects</h3> 88 <h3 id="eventobjects">Event objects</h3>
89 89
90 <p> 90 <p>
91 <a href="events.html">Event objects</a> may support rules. These event objects 91 <a href="events">Event objects</a> may support rules. These event objects
92 don't call a callback function when events happen but test whether any 92 don't call a callback function when events happen but test whether any
93 registered rule has at least one fulfilled condition and execute the actions 93 registered rule has at least one fulfilled condition and execute the actions
94 associated with this rule. Event objects supporting the declarative API have 94 associated with this rule. Event objects supporting the declarative API have
95 three relevant methods: $(ref:events.Event.addRules), 95 three relevant methods: $(ref:events.Event.addRules),
96 $(ref:events.Event.removeRules), and 96 $(ref:events.Event.removeRules), and
97 $(ref:events.Event.getRules). 97 $(ref:events.Event.getRules).
98 </p> 98 </p>
99 99
100 <h3 id="addingrules">Adding rules</h3> 100 <h3 id="addingrules">Adding rules</h3>
101 101
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 </div> 228 </div>
229 {{/is_apps}} 229 {{/is_apps}}
230 230
231 {{^is_apps}} 231 {{^is_apps}}
232 <div class="doc-family extensions"> 232 <div class="doc-family extensions">
233 <h2 id="filtered">Filtered events</h2> 233 <h2 id="filtered">Filtered events</h2>
234 234
235 <p>Filtered events are a mechanism that allows listeners to specify a subset of 235 <p>Filtered events are a mechanism that allows listeners to specify a subset of
236 events that they are interested in. A listener that makes use of a filter won't 236 events that they are interested in. A listener that makes use of a filter won't
237 be invoked for events that don't pass the filter, which makes the listening 237 be invoked for events that don't pass the filter, which makes the listening
238 code more declarative and efficient - an <a href="event_pages.html">event 238 code more declarative and efficient - an <a href="event_pages">event
239 page</a> page need not be woken up to handle events it doesn't care 239 page</a> page need not be woken up to handle events it doesn't care
240 about.</p> 240 about.</p>
241 241
242 <p>Filtered events are intended to allow a transition from manual filtering 242 <p>Filtered events are intended to allow a transition from manual filtering
243 code like this:</p> 243 code like this:</p>
244 244
245 <pre> 245 <pre>
246 chrome.webNavigation.onCommitted.addListener(function(e) { 246 chrome.webNavigation.onCommitted.addListener(function(e) {
247 if (hasHostSuffix(e.url, 'google.com') || 247 if (hasHostSuffix(e.url, 'google.com') ||
248 hasHostSuffix(e.url, 'google.com.au')) { 248 hasHostSuffix(e.url, 'google.com.au')) {
(...skipping 15 matching lines...) Expand all
264 of filters that an event supports will be listed in the documentation for that 264 of filters that an event supports will be listed in the documentation for that
265 event in the "filters" section.</p> 265 event in the "filters" section.</p>
266 266
267 <p>When matching URLs (as in the example above), event filters support the same 267 <p>When matching URLs (as in the example above), event filters support the same
268 URL matching capabilities as expressible with a 268 URL matching capabilities as expressible with a
269 $(ref:events.UrlFilter), except for scheme and port 269 $(ref:events.UrlFilter), except for scheme and port
270 matching.</p> 270 matching.</p>
271 271
272 </div> 272 </div>
273 {{/is_apps}} 273 {{/is_apps}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698