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

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

Issue 10826295: Revert 151420 - Add documentation for filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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.tabs.onCreated</code> event 6 <code>chrome.tabs.onCreated</code> event
7 to be notified whenever there's a new tab: 7 to be notified whenever there's a new tab:
8 </p> 8 </p>
9 9
10 <pre> 10 <pre>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 <pre> 148 <pre>
149 var rule_ids = ["id1", "id2", ...]; 149 var rule_ids = ["id1", "id2", ...];
150 function getRules(rule_ids, function callback(details) {...}); 150 function getRules(rule_ids, function callback(details) {...});
151 </pre> 151 </pre>
152 152
153 <p> 153 <p>
154 The <code>details</code> parameter passed to the <code>calback()</code> function 154 The <code>details</code> parameter passed to the <code>calback()</code> function
155 refers to an array of rules including filled optional parameters. 155 refers to an array of rules including filled optional parameters.
156 </p> 156 </p>
157 </div> 157 </div>
158 {{/is_apps}}
159
160 {{^is_apps}}
161 <div class="doc-family extensions">
162 <h2 id="filtered">Filtered events</h2>
163
164 <p>Filtered events are a mechanism that allows listeners to specify a subset of
165 events that they are interested in. A listener that makes use of a filter won't
166 be invoked for events that don't pass the filter, which makes the listening
167 code more declarative and efficient - an <a href="event_pages.html">event
168 page</a> page need not be woken up to handle events it doesn't care
169 about.</p>
170
171 <p>Filtered events are intended to allow a transition from manual filtering
172 code like this:</p>
173
174 <pre>
175 chrome.webNavigation.onCommitted.addListener(function(e) {
176 if (hasHostSuffix(e.url, 'google.com') ||
177 hasHostSuffix(e.url, 'google.com.au')) {
178 // ...
179 }
180 });
181 </pre>
182
183 <p>into this:</p>
184
185 <pre>
186 chrome.webNavigation.onCommitted.addListener(function(e) {
187 // ...
188 }, {url: [{hostSuffix: 'google.com'},
189 {hostSuffix: 'google.com.au'}]});
190 </pre>
191
192 <p>Events support specific filters that are meaningful to that event. The list
193 of filters that an event supports will be listed in the documentation for that
194 event in the "filters" section.</p>
195
196 <p>When matching URLs (as in the example above), event filters support the same
197 URL matching capabilities as expressable with a <a
198 href="events.html#type-UrlFilter">UrlFilter</a>, except for scheme and port
199 matching.</p>
200
201 </div>
202 {{/is_apps}} 158 {{/is_apps}}
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/PRESUBMIT.py ('k') | chrome/common/extensions/docs/static/events.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698