| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
| 2 <!-- This page is a placeholder for generated extensions api doc. Note: | |
| 3 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
| 4 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
| 5 templating mechanism. | 4 templating mechanism. |
| 6 2) The <body> tag *must* retain id="body" | 5 2) The <body> tag *must* retain id="body" |
| 7 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 6 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
| 8 browser, it will be re-generated from the template, json schema and | 7 browser, it will be re-generated from the template, json schema and |
| 9 authored overview content. | 8 authored overview content. |
| 10 4) The <body>.innerHTML is also generated by an offline step so that this | 9 4) The <body>.innerHTML is also generated by an offline step so that this |
| 11 page may easily be indexed by search engines. | 10 page may easily be indexed by search engines. |
| 12 | 11 |
| 13 TODO(rafaelw): Abstract this into a "pageshell" that becomes the single | 12 TODO(rafaelw): Abstract this into a "pageshell" that becomes the single |
| 14 version of page template shell and the "instance" pages (bookmarks.html, | 13 version of page template shell and the "instance" pages (bookmarks.html, |
| 15 etc...) can be generated with a build step. | 14 etc...) can be generated with a build step. |
| 16 --> | 15 --><!-- <html> must retain id="template --><html xmlns="http://www.w3.org/1999/x
html" jstcache="0"><!-- <head> data is significant and loads the needed librarie
s and styles --><head jstcache="0"> |
| 17 <!-- <html> must retain id="template --> | 16 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" jstcache=
"0"> |
| 18 <html xmlns="http://www.w3.org/1999/xhtml"> | 17 <title jscontent="getPageTitle()" jstcache="1">Events</title> |
| 19 <!-- <head> data is significant and loads the needed libraries and styles --> | 18 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css" jstcache=
"0"> |
| 20 <head> | 19 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js" jstcache="0"> |
| 21 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| 22 <title jscontent="getPageTitle()">pageTitle</title> | |
| 23 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | |
| 24 <script type="text/javascript" | |
| 25 src="../../../third_party/jstemplate/jstemplate_compiled.js"> | |
| 26 </script> | 20 </script> |
| 27 <script type="text/javascript" src="js/api_page_generator.js"></script> | 21 <script type="text/javascript" src="js/api_page_generator.js" jstcache="0"><
/script> |
| 28 <script type="text/javascript" src="js/bootstrap.js"></script> | 22 <script type="text/javascript" src="js/bootstrap.js" jstcache="0"></script> |
| 29 </head> | 23 </head><!-- <body> content is completely generated. Do not edit, as it will be |
| 30 <!-- <body> content is completely generated. Do not edit, as it will be | 24 and rewritten. --><body jstcache="0"> <div id="container" jstcache="0"> |
| 31 and rewritten. --> | 25 <a name="top" jstcache="0"> </a> |
| 32 <body> | 26 <!-- API HEADER --> |
| 33 </body> | 27 <div id="pageHeader" jstcache="0"> |
| 34 </html> | 28 <div id="searchbox" jstcache="0"> |
| 29 <form action="http://www.google.com/cse" id="cse-search-box" jstcache="0
"> |
| 30 <div jstcache="0"> |
| 31 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfq
tno" jstcache="0"> |
| 32 <input type="hidden" name="ie" value="UTF-8" jstcache="0"> |
| 33 <input type="text" name="q" size="31" jstcache="0"> |
| 34 <input type="submit" name="sa" value="Search" jstcache="0"> |
| 35 </div> |
| 36 </form> |
| 37 |
| 38 <script type="text/javascript" src="http://www.google.com/jsapi" jstcach
e="0"></script> |
| 39 <script type="text/javascript" jstcache="0">google.load("elements", "1",
{packages: "transliteration"});</script> |
| 40 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?
form=cse-search-box&t13n_langs=en" jstcache="0"></script> |
| 41 <script type="text/javascript" src="http://www.google.com/coop/cse/brand
?form=cse-search-box&lang=en" jstcache="0"></script> |
| 42 </div> |
| 43 <div id="pageTitle" jstcache="0"> |
| 44 <h1 jscontent="getPageTitle()" jstcache="1">Events</h1> |
| 45 </div> |
| 46 </div> <!-- /pageHeader --> |
| 47 |
| 48 <div id="pageContent" jstcache="0"> |
| 49 <!-- SIDENAV --> |
| 50 <div id="leftNav" jstcache="0"> |
| 51 <ul jstcache="0"> |
| 52 <li jstcache="0"> <a href="index.html" jstcache="0">Home</a></li> |
| 53 <li jstcache="0"> <a href="getstarted.html" jstcache="0">Getting Start
ed</a></li> |
| 54 <li jstcache="0"> <a href="overview.html" jstcache="0">Overview</a></l
i> |
| 55 <li jstcache="0"> <a href="devguide.html" jstcache="0"><div jstcache="
0">Developer's Guide</div></a> |
| 56 <ul jstcache="0"> |
| 57 <li jstcache="0"><a href="toolstrip.html" jstcache="0">Toolstrips<
/a></li> |
| 58 <li jstcache="0"><a href="pageActions.html" jstcache="0">Page Acti
ons</a></li> |
| 59 <li jstcache="0"><a href="background_pages.html" jstcache="0">Back
ground Pages</a></li> |
| 60 <li jstcache="0"><a href="content_scripts.html" jstcache="0">Conte
nt Scripts</a></li> |
| 61 <li jstcache="0" class="leftNavSelected">Events</li> |
| 62 <li jstcache="0"><a href="tabs.html" jstcache="0">Tabs</a></li> |
| 63 <li jstcache="0"><a href="windows.html" jstcache="0">Windows</a></
li> |
| 64 <li jstcache="0"><a href="bookmarks.html" jstcache="0">Bookmarks</
a></li> |
| 65 <li jstcache="0"><a href="themes.html" jstcache="0">Themes</a></li
> |
| 66 <li jstcache="0"><a href="npapi.html" jstcache="0">NPAPI Plugins</
a></li> |
| 67 <li jstcache="0"><a href="packaging.html" jstcache="0">Packaging</
a></li> |
| 68 <li jstcache="0">Autoupdate</li> |
| 69 </ul> |
| 70 </li> |
| 71 <li jstcache="0"><a href="tutorials.html" jstcache="0"><div jstcache="
0">Tutorials</div></a> |
| 72 <ul jstcache="0"> |
| 73 <li jstcache="0"><a href="tut_debugging.html" jstcache="0">Debuggi
ng</a></li> |
| 74 </ul> |
| 75 </li> |
| 76 <li jstcache="0">Reference |
| 77 <ul jstcache="0"> |
| 78 <li jstcache="0"> Formats |
| 79 <ul jstcache="0"> |
| 80 <li jstcache="0"><a href="manifest.html" jstcache="0">Manifest
Files</a></li> |
| 81 <li jstcache="0"><a href="match_patterns.html" jstcache="0">Ma
tch Patterns</a></li> |
| 82 <li jstcache="0">Packages (.crx)</li> |
| 83 </ul> |
| 84 </li> |
| 85 <li jstcache="0"> <a href="api_index.html" jstcache="0">chrome.* A
PIs</a> </li> |
| 86 <li jstcache="0"> <a href="api_other.html" jstcache="0">Other APIs
</a> </li> |
| 87 </ul> |
| 88 </li> |
| 89 <li jstcache="0"><a href="http://dev.chromium.org/developers/design-doc
uments/extensions/samples" jstcache="0">Samples</a></li> |
| 90 </ul> |
| 91 </div> |
| 92 |
| 93 <div id="mainColumn" jstcache="0"> |
| 94 <!-- TABLE OF CONTENTS --> |
| 95 <div id="toc" jsdisplay="showPageTOC()" jstcache="2" style="display: non
e; "> |
| 96 <p jstcache="0">Contents</p> |
| 97 <ol jstcache="0"> |
| 98 <li jsselect="getStaticTOC()" jstcache="9"> |
| 99 <a jscontent="name" jsvalues=".href:'#' + href" jstcache="14">h2Na
me</a> |
| 100 <ol jstcache="0"> |
| 101 <li jsselect="$this.children" jstcache="22"> |
| 102 <a jscontent="name" jsvalues=".href:'#' + href" jstcache="14">
h3Name</a> |
| 103 </li> |
| 104 </ol> |
| 105 </li> |
| 106 <div jsselect="apiDefinition" jstcache="3"> |
| 107 <li jstcache="0"> |
| 108 <a href="#apiReference" jscontent="'API reference: ' + getModule
Name()" jstcache="4">API reference</a> |
| 109 <ol jstcache="0"> |
| 110 <li jsdisplay="$this.properties" jstcache="5"> |
| 111 <a href="#properties" jstcache="0">Properties</a> |
| 112 <ol jstcache="0"> |
| 113 <li jsselect="getPropertyListFromObject($this)" jstcache="
10"> |
| 114 <a jscontent="name" jsvalues=".href:'#property-' + name"
href="#property-anchor" jstcache="42">propertyName</a> |
| 115 </li> |
| 116 </ol> |
| 117 </li> |
| 118 <li jsdisplay="functions && functions.length > 0" j
stcache="6"> |
| 119 <a href="#methods" jstcache="0">Methods</a> |
| 120 <ol jstcache="0"> |
| 121 <li jsselect="functions.sort(sortByName)" jstcache="11"> |
| 122 <a jscontent="name" jsvalues=".href:'#method-' + name" h
ref="#method-anchor" jstcache="43">methodName</a> |
| 123 </li> |
| 124 </ol> |
| 125 </li> |
| 126 <li jsdisplay="events && events.length > 0" jstcach
e="7"> |
| 127 <a href="#events" jstcache="0">Events</a> |
| 128 <ol jstcache="0"> |
| 129 <li jsselect="events.sort(sortByName)" jstcache="12"> |
| 130 <a jscontent="name" jsvalues=".href:'#event-' + name" hr
ef="#event-anchor" jstcache="44">eventName</a> |
| 131 </li> |
| 132 </ol> |
| 133 </li> |
| 134 <li jsdisplay="types && types.length > 0" jstcache=
"8"> |
| 135 <a href="#types" jstcache="0">Types</a> |
| 136 <ol jstcache="0"> |
| 137 <li jsselect="types.sort(sortByName)" jstcache="38"> |
| 138 <a jscontent="id" jsvalues=".href:'#type-' + id" href="#
id-anchor" jstcache="45">id</a> |
| 139 </li> |
| 140 </ol> |
| 141 </li> |
| 142 </ol> |
| 143 </li> |
| 144 </div> |
| 145 </ol> |
| 146 </div> |
| 147 <!-- /TABLE OF CONTENTS --> |
| 148 |
| 149 <!-- STATIC CONTENT PLACEHOLDER --> |
| 150 <div id="static" jstcache="0"><p jstcache="0"> |
| 151 An <code jstcache="0">Event</code> is an object |
| 152 that allows you to be notified |
| 153 when something interesting happens. |
| 154 Here's an example of using the |
| 155 <code jstcache="0">chrome.tabs.onCreated</code> event |
| 156 to be notified whenever there's a new tab: |
| 157 </p> |
| 158 |
| 159 <pre jstcache="0">chrome.tabs.onCreated.<b jstcache="0">addListener(function(</b
>tab<b jstcache="0">) {</b> |
| 160 appendToLog('tabs.onCreated --' |
| 161 + ' window: ' + tab.windowId |
| 162 + ' tab: ' + tab.id |
| 163 + ' index: ' + tab.index |
| 164 + ' url: ' + tab.url); |
| 165 <b jstcache="0">});</b> |
| 166 </pre> |
| 167 |
| 168 <p jstcache="0"> |
| 169 As the example shows, |
| 170 you register for notification using <code jstcache="0">addListener()</code>. |
| 171 The argument to <code jstcache="0">addListener()</code> |
| 172 is always a function that you define to handle the event, |
| 173 but the parameters to the function depend on |
| 174 which event you're handling. |
| 175 Checking the documentation for |
| 176 <a href="tabs.html#event-onCreated" jstcache="0"><code jstcache="0">chrome.tabs.
onCreated</code></a>, |
| 177 you can see that the function has a single parameter: |
| 178 a <a href="tabs.html#type-Tab" jstcache="0">Tab</a> object |
| 179 that has details about the newly created tab. |
| 180 </p> |
| 181 |
| 182 <h2 jstcache="0"> |
| 183 Methods |
| 184 </h2> |
| 185 |
| 186 <p jstcache="0"> |
| 187 You can invoke the following methods on any <code jstcache="0">Event</code> obje
ct: |
| 188 </p> |
| 189 |
| 190 <pre jstcache="0">void addListener(function callback(...)) |
| 191 void removeListener(function callback(...)) |
| 192 bool hasListener(function callback(...)) |
| 193 </pre> |
| 194 |
| 195 <p class="comment" jstcache="0"> |
| 196 [PENDING: explain removeListener and hasListener] |
| 197 </p></div> |
| 198 |
| 199 <!-- API PAGE --> |
| 200 <div class="apiPage" jsselect="apiDefinition" jstcache="3" style="displa
y: none; "> |
| 201 <a name="apiReference" jstcache="0"></a> |
| 202 <h2 jscontent="'API reference: ' + getModuleName()" jstcache="4">API ref
erence: chrome.apiname </h2> |
| 203 |
| 204 <!-- PROPERTIES --> |
| 205 <div jsdisplay="$this.properties" class="apiGroup" jstcache="5"> |
| 206 <a name="properties" jstcache="0"></a> |
| 207 <h3 id="properties" jstcache="0">Properties</h3> |
| 208 |
| 209 <div jsselect="getPropertyListFromObject($this)" jstcache="10"> |
| 210 <a jsvalues=".name:'property-' + name" jstcache="15"></a> |
| 211 <h4 jscontent="name" jstcache="16">getLastError</h4> |
| 212 <div class="summary" jstcache="0"> |
| 213 <!-- Note: intentionally longer 80 columns --> |
| 214 <span jscontent="getModuleName() + '.'" jstcache="23">chrome.ext
ension</span><span jscontent="$this.name" jstcache="24">lastError</span> |
| 215 </div> |
| 216 <div transclude="valueTemplate" jstcache="17"> |
| 217 </div> |
| 218 </div> |
| 219 |
| 220 </div> <!-- /apiGroup --> |
| 221 |
| 222 <!-- METHODS --> |
| 223 <div jsdisplay="functions && functions.length > 0" class="a
piGroup" id="methods" jstcache="6"> |
| 224 <a name="methods" jstcache="0"></a> |
| 225 <h3 jstcache="0">Methods</h3> |
| 226 |
| 227 <!-- iterates over all functions --> |
| 228 <div class="apiItem" jsselect="functions.sort(sortByName)" jstcache=
"11"> |
| 229 <a jsvalues=".name:'method-' + name" jstcache="18"></a> <!-- metho
d-anchor --> |
| 230 <h4 jscontent="name" jstcache="16">method name</h4> |
| 231 |
| 232 <div class="summary" jstcache="0"><span jsdisplay="returns" jscont
ent="getTypeName(returns)" jstcache="25">void</span> |
| 233 <!-- Note: intentionally longer 80 columns --> |
| 234 <span jscontent="getFullyQualifiedFunctionName($this)" jstcach
e="26">chrome.module.methodName</span>(<span jsselect="parameters" jsvalues="cla
ss:optional ? 'optional' : ''" jstcache="27"><span jsdisplay="$index" jstcache="
33">, </span><span jscontent="getTypeName($this)" jstcache="34"></span> |
| 235 <var jstcache="0"><span jscontent="name" jstcache="16"></s
pan></var></span>)</div> |
| 236 |
| 237 <div class="description" jstcache="0"> |
| 238 <p class="todo" jsdisplay="!description" jstcache="28">Undocumen
ted.</p> |
| 239 <p jsdisplay="description" jsvalues=".innerHTML:description" jst
cache="29"> |
| 240 A description from the json schema def of the function goes he
re. |
| 241 </p> |
| 242 |
| 243 <!-- PARAMETERS --> |
| 244 <h4 jstcache="0">Parameters</h4> |
| 245 <dl jstcache="0"> |
| 246 <div jsselect="parameters" jstcache="35"> |
| 247 |
| 248 <!-- VALUE: This is a subtemplate that is used elsewhere |
| 249 via jsTemplate *transclude* --> |
| 250 <div id="valueTemplate" jstcache="0"> |
| 251 <dt jstcache="0"> |
| 252 <var jsdisplay="$this.name" jscontent="$this.name" jstca
che="46">paramName</var> |
| 253 <em jstcache="0"> |
| 254 |
| 255 <!-- TYPE --> |
| 256 <div style="display:inline" jstcache="0"> |
| 257 ( |
| 258 <span class="optional" jsdisplay="optional" jstc
ache="47">optional</span> |
| 259 <span id="typeTemplate" jstcache="0"> |
| 260 <span jsdisplay="getTypeRef($this)" jstcache="
48"> |
| 261 <a jsvalues=".href: getTypeRefPage($this) +
'#type-' + getTypeRef($this)" jscontent="getTypeRef($this)" jstcache="50"> Type<
/a> |
| 262 </span> |
| 263 <span jsdisplay="!getTypeRef($this)" jstcache=
"49"> |
| 264 <span jsdisplay="isArray($this)" jstcache="5
1"> |
| 265 array of <span jsselect="items" jstcache="
53"><span transclude="typeTemplate" jstcache="54"></span></span> |
| 266 </span> |
| 267 <span jsdisplay="!isArray($this)" jscontent=
"getTypeName($this)" jstcache="52">paramType</span> |
| 268 </span> |
| 269 </span> |
| 270 ) |
| 271 </div> |
| 272 |
| 273 </em> |
| 274 </dt> |
| 275 <dd class="todo" jsdisplay="!$this.description" jstcache="
39"> |
| 276 Undocumented. |
| 277 </dd> |
| 278 <dd jsdisplay="$this.description" jsvalues=".innerHTML:$th
is.description" jstcache="40"> |
| 279 Description of this parameter from the json schema. |
| 280 </dd> |
| 281 |
| 282 <!-- OBJECT PROPERTIES --> |
| 283 <dd jsdisplay="shouldExpandObject($this)" jstcache="41"> |
| 284 <dl jstcache="0"> |
| 285 <div jsselect="getPropertyListFromObject($this)" jstca
che="10"> |
| 286 <div transclude="valueTemplate" jstcache="17"> |
| 287 </div> |
| 288 </div> |
| 289 </dl> |
| 290 </dd> |
| 291 </div> <!-- /VALUE --> |
| 292 |
| 293 </div> |
| 294 </dl> |
| 295 |
| 296 <!-- RETURNS --> |
| 297 <h4 jsdisplay="returns" jstcache="30">Returns</h4> |
| 298 <dl jstcache="0"> |
| 299 <div jsselect="returns" jstcache="36"> |
| 300 <div transclude="valueTemplate" jstcache="17"> |
| 301 </div> |
| 302 </div> |
| 303 </dl> |
| 304 |
| 305 <!-- CALLBACK --> |
| 306 <div jsdisplay="hasCallback(parameters)" jstcache="31"> |
| 307 <div jsselect="getCallbackParameters(parameters)" jstcache="37
"> |
| 308 <h4 jstcache="0">Callback function</h4> |
| 309 <p jstcache="0"> |
| 310 If you specify the <em jstcache="0">callback</em> parameter, |
| 311 it should specify a function that looks like this: |
| 312 </p> |
| 313 |
| 314 <!-- Note: intentionally longer 80 columns --> |
| 315 <pre jstcache="0">function(<span jscontent="getSignatureString
(parameters)" jstcache="32">Type param1, Type param2</span>) <span class="subdue
d" jstcache="0">{...}</span>);</pre> |
| 316 <dl jstcache="0"> |
| 317 <div jsselect="parameters" jstcache="35"> |
| 318 <div transclude="valueTemplate" jstcache="17"> |
| 319 </div> |
| 320 </div> |
| 321 </dl> |
| 322 </div> |
| 323 </div> |
| 324 |
| 325 </div> <!-- /description --> |
| 326 |
| 327 </div> <!-- /apiItem --> |
| 328 |
| 329 </div> <!-- /apiGroup --> |
| 330 |
| 331 <!-- EVENTS --> |
| 332 <div jsdisplay="events && events.length > 0" class="apiGrou
p" jstcache="7"> |
| 333 <a name="events" jstcache="0"></a> |
| 334 <h3 id="events" jstcache="0">Events</h3> |
| 335 |
| 336 <!-- iterates over all events --> |
| 337 <div jsselect="events.sort(sortByName)" class="apiItem" jstcache="12
"> |
| 338 <a jsvalues=".name:'event-' + name" jstcache="19"></a> |
| 339 <h4 jscontent="name" jstcache="16">event name</h4> |
| 340 |
| 341 <div class="summary" jstcache="0"> |
| 342 <!-- Note: intentionally longer 80 columns --> |
| 343 <span jscontent="getModuleName() + '.'" class="subdued" jstcache
="23">chrome.bookmarks</span><span jscontent="name" jstcache="16">onEvent</span>
<span class="subdued" jstcache="0">.addListener</span>(function(<span jscontent=
"getSignatureString(parameters)" jstcache="32">Type param1, Type param2</span>)
<span class="subdued" jstcache="0">{...}</span>); |
| 344 </div> |
| 345 |
| 346 <div class="description" jstcache="0"> |
| 347 <p class="todo" jsdisplay="!description" jstcache="28">Undocumen
ted.</p> |
| 348 <p jsdisplay="description" jsvalues=".innerHTML:description" jst
cache="29"> |
| 349 A description from the json schema def of the event goes here. |
| 350 </p> |
| 351 |
| 352 <!-- PARAMETERS --> |
| 353 <h4 jstcache="0">Parameters</h4> |
| 354 <dl jstcache="0"> |
| 355 <div jsselect="parameters" jstcache="35"> |
| 356 <div transclude="valueTemplate" jstcache="17"> |
| 357 </div> |
| 358 </div> |
| 359 </dl> |
| 360 |
| 361 </div> <!-- /decription --> |
| 362 |
| 363 </div> <!-- /apiItem --> |
| 364 |
| 365 </div> <!-- /apiGroup --> |
| 366 |
| 367 <!-- TYPES --> |
| 368 <div jsdisplay="types && types.length > 0" class="apiGroup"
jstcache="8"> |
| 369 <a name="types.sort(sortByName)" jstcache="0"></a> |
| 370 <h3 id="types" jstcache="0">Types</h3> |
| 371 |
| 372 <!-- iterates over all types --> |
| 373 <div jsselect="types" class="apiItem" jstcache="13"> |
| 374 <a jsvalues=".name:'type-' + id" jstcache="20"></a> |
| 375 <h4 jscontent="id" jstcache="21">type name</h4> |
| 376 |
| 377 <div transclude="valueTemplate" jstcache="17"> |
| 378 </div> |
| 379 |
| 380 </div> <!-- /apiItem --> |
| 381 |
| 382 </div> <!-- /apiGroup --> |
| 383 |
| 384 </div> <!-- /apiPage --> |
| 385 </div> <!-- /mainColumn --> |
| 386 </div> <!-- /pageContent --> |
| 387 <div id="pageFooter" --="" jstcache="0"> |
| 388 <p jstcache="0"> |
| 389 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
" jstcache="0">noted</a>, |
| 390 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/" jstcache="0">Creative Commons |
| 391 Attribution 3.0 License</a>, and code samples are licensed under the |
| 392 <a rel="license" href="http://code.google.com/google_bsd_license.html" jstcach
e="0">BSD License</a>. |
| 393 </p> |
| 394 <p jstcache="0"> |
| 395 ©2009 Google |
| 396 </p> |
| 397 </div> <!-- /pageFooter --> |
| 398 </div> <!-- /container --> |
| 399 </body></html> |
| 400 #EOF |
| OLD | NEW |