idle.html revision 4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7
1<!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note: 2 1) The <head> information in this page is significant, should be uniform 3 across api docs and should be edited only with knowledge of the 4 templating mechanism. 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a 6 browser, it will be re-generated from the template, json schema and 7 authored overview content. 8 4) The <body>.innerHTML is also generated by an offline step so that this 9 page may easily be indexed by search engines. 10--><html xmlns="http://www.w3.org/1999/xhtml"><head> 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> 13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> 14 <script type="text/javascript" src="/third_party/jstemplate/jstemplate_compiled.js"> 15 </script> 16 <script type="text/javascript" src="js/api_page_generator.js"></script> 17 <script type="text/javascript" src="js/bootstrap.js"></script> 18 <script type="text/javascript" src="js/sidebar.js"></script> 19 <title>Idle - Google Chrome Extensions - Google Code</title></head> 20 <body> <div id="gc-container" class="labs"> 21 <div id="devModeWarning"> 22 You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. 23 </div> 24 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> 25 <!-- In particular, sub-templates that recurse, must be used by allowing 26 jstemplate to make a copy of the template in this section which 27 are not operated on by way of the jsskip="true" --> 28 <div style="display:none"> 29 30 <!-- VALUE --> 31 <div id="valueTemplate"> 32 <dt> 33 <var>paramName</var> 34 <em> 35 36 <!-- TYPE --> 37 <div style="display:inline"> 38 ( 39 <span class="optional">optional</span> 40 <span class="enum">enumerated</span> 41 <span id="typeTemplate"> 42 <span> 43 <a> Type</a> 44 </span> 45 <span> 46 <span> 47 array of <span><span></span></span> 48 </span> 49 <span>paramType</span> 50 <span></span> 51 </span> 52 </span> 53 ) 54 </div> 55 56 </em> 57 </dt> 58 <dd class="todo"> 59 Undocumented. 60 </dd> 61 <dd> 62 Description of this parameter from the json schema. 63 </dd> 64 <dd> 65 This parameter was added in version 66 <b><span></span></b>. 67 You must omit this parameter in earlier versions, 68 and you may omit it in any version. If you require this 69 parameter, the manifest key 70 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 71 can ensure that your extension won't be run in an earlier browser version. 72 </dd> 73 74 <!-- OBJECT PROPERTIES --> 75 <dd> 76 <dl> 77 <div> 78 <div> 79 </div> 80 </div> 81 </dl> 82 </dd> 83 84 <!-- FUNCTION PARAMETERS --> 85 <dd> 86 <div></div> 87 </dd> 88 89 </div> <!-- /VALUE --> 90 91 <div id="functionParametersTemplate"> 92 <h5>Parameters</h5> 93 <dl> 94 <div> 95 <div> 96 </div> 97 </div> 98 </dl> 99 </div> 100 </div> <!-- /SUBTEMPLATES --> 101 102 <a id="top"></a> 103 <div id="skipto"> 104 <a href="#gc-pagecontent">Skip to page content</a> 105 <a href="#gc-toc">Skip to main navigation</a> 106 </div> 107 <!-- API HEADER --> 108 <table id="header" width="100%" cellspacing="0" border="0"> 109 <tbody><tr> 110 <td valign="middle"><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:0; margin:0;"></a></td> 111 <td valign="middle" width="100%" style="padding-left:0.6em;"> 112 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em"> 113 <div id="gsc-search-box"> 114 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno"> 115 <input type="hidden" name="ie" value="UTF-8"> 116 <input type="text" name="q" value="" size="55"> 117 <input class="gsc-search-button" type="submit" name="sa" value="Search"> 118 <br> 119 <span class="greytext">e.g. "page action" or "tabs"</span> 120 </div> 121 </form> 122 123 <script type="text/javascript" src="http://www.google.com/jsapi"></script> 124 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script> 125 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&t13n_langs=en"></script> 126 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&lang=en"></script> 127 </td> 128 </tr> 129 </tbody></table> 130 131 <div id="codesiteContent" class=""> 132 133 <a id="gc-topnav-anchor"></a> 134 <div id="gc-topnav"> 135 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1> 136 <ul id="home" class="gc-topnav-tabs"> 137 <li id="home_link"> 138 <a href="index.html" title="Google Chrome Extensions home page">Home</a> 139 </li> 140 <li id="docs_link"> 141 <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a> 142 </li> 143 <li id="faq_link"> 144 <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a> 145 </li> 146 <li id="samples_link"> 147 <a href="samples.html" title="Sample extensions (with source code)">Samples</a> 148 </li> 149 <li id="group_link"> 150 <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a> 151 </li> 152 </ul> 153 </div> <!-- end gc-topnav --> 154 155 <div class="g-section g-tpl-170"> 156 <!-- SIDENAV --> 157 <div class="g-unit g-first" id="gc-toc"> 158 <ul> 159 <li><a href="getstarted.html">Getting Started</a></li> 160 <li><a href="overview.html">Overview</a></li> 161 <li><a href="whats_new.html">What's New?</a></li> 162 <li><h2><a href="devguide.html">Developer's Guide</a></h2> 163 <ul> 164 <li>Browser UI 165 <ul> 166 <li><a href="browserAction.html">Browser Actions</a></li> 167 <li><a href="contextMenus.html">Context Menus</a></li> 168 <li><a href="notifications.html">Desktop Notifications</a></li> 169 <li><a href="options.html">Options Pages</a></li> 170 <li><a href="override.html">Override Pages</a></li> 171 <li><a href="pageAction.html">Page Actions</a></li> 172 <li><a href="themes.html">Themes</a></li> 173 </ul> 174 </li> 175 <li>Browser Interaction 176 <ul> 177 <li><a href="bookmarks.html">Bookmarks</a></li> 178 <li><a href="cookies.html">Cookies</a></li> 179 <li><a href="events.html">Events</a></li> 180 <li><a href="history.html">History</a></li> 181 <li><a href="management.html">Management</a></li> 182 <li><a href="tabs.html">Tabs</a></li> 183 <li><a href="windows.html">Windows</a></li> 184 </ul> 185 </li> 186 <li>Implementation 187 <ul> 188 <li><a href="a11y.html">Accessibility</a></li> 189 <li><a href="background_pages.html">Background Pages</a></li> 190 <li><a href="content_scripts.html">Content Scripts</a></li> 191 <li><a href="xhr.html">Cross-Origin XHR</a></li> 192 <li class="leftNavSelected">Idle</li> 193 <li><a href="i18n.html">Internationalization</a></li> 194 <li><a href="messaging.html">Message Passing</a></li> 195 <li><a href="npapi.html">NPAPI Plugins</a></li> 196 </ul> 197 </li> 198 <li>Finishing 199 <ul> 200 <li><a href="hosting.html">Hosting</a></li> 201 <li><a href="external_extensions.html">Other Deployment Options</a></li> 202 </ul> 203 </li> 204 </ul> 205 </li> 206 <li><h2><a href="tutorials.html">Tutorials</a></h2> 207 <ul> 208 <li><a href="tut_debugging.html">Debugging</a></li> 209 <li><a href="tut_analytics.html">Google Analytics</a></li> 210 <li><a href="tut_oauth.html">OAuth</a></li> 211 </ul> 212 </li> 213 <li><h2>Reference</h2> 214 <ul> 215 <li>Formats 216 <ul> 217 <li><a href="manifest.html">Manifest Files</a></li> 218 <li><a href="match_patterns.html">Match Patterns</a></li> 219 <!-- <li>Packages (.crx)</li> --> 220 </ul> 221 </li> 222 <li><a href="api_index.html">chrome.* APIs</a></li> 223 <li><a href="api_other.html">Other APIs</a></li> 224 </ul> 225 </li> 226 <li><h2><a href="samples.html">Samples</a></h2></li> 227 <div class="line"> </div> 228 <li><h2>More</h2> 229 <ul> 230 <li><a href="http://code.google.com/chrome/webstore/docs/index.html">Chrome Web Store</a></li> 231 <li><a href="http://code.google.com/chrome/apps/docs/developers_guide.html">Installable Web Apps</a></li> 232 <li><a href="themes.html">Themes</a></li> 233 </ul> 234 </li> 235 </ul> 236 </div> 237 <script> 238 initToggles(); 239 </script> 240 241 <div class="g-unit" id="gc-pagecontent"> 242 <div id="pageTitle"> 243 <h1 class="page_title">Idle</h1> 244 </div> 245 <!-- TABLE OF CONTENTS --> 246 <div id="toc"> 247 <h2>Contents</h2> 248 <ol> 249 <li> 250 <a href="#manifest">Manifest</a> 251 <ol> 252 <li style="display: none; "> 253 <a>h3Name</a> 254 </li> 255 </ol> 256 </li> 257 <li> 258 <a href="#apiReference">API reference: chrome.idle</a> 259 <ol> 260 <li style="display: none; "> 261 <a href="#properties">Properties</a> 262 <ol> 263 <li> 264 <a href="#property-anchor">propertyName</a> 265 </li> 266 </ol> 267 </li> 268 <li> 269 <a href="#methods">Methods</a> 270 <ol> 271 <li> 272 <a href="#method-queryState">queryState</a> 273 </li> 274 </ol> 275 </li> 276 <li> 277 <a href="#events">Events</a> 278 <ol> 279 <li> 280 <a href="#event-onStateChanged">onStateChanged</a> 281 </li> 282 </ol> 283 </li> 284 <li style="display: none; "> 285 <a href="#types">Types</a> 286 <ol> 287 <li> 288 <a href="#id-anchor">id</a> 289 </li> 290 </ol> 291 </li> 292 </ol> 293 </li> 294 </ol> 295 </div> 296 <!-- /TABLE OF CONTENTS --> 297 298 <!-- Standard content lead-in for experimental API pages --> 299 <p id="classSummary" style="display: none; "> 300 For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. 301 </p> 302 303 <!-- STATIC CONTENT PLACEHOLDER --> 304 <div id="static"><div id="pageData-name" class="pageData">Idle</div> 305 306<!-- BEGIN AUTHORED CONTENT --> 307<h2 id="manifest">Manifest</h2> 308<p>You must declare the "idle" permission in your extension's manifest to use the idle API. 309For example: 310</p> 311 312<pre>{ 313 "name": "My extension", 314 ... 315 <b>"permissions": [ 316 "idle" 317 ]</b>, 318 ... 319}</pre> 320 321<!-- END AUTHORED CONTENT --> 322</div> 323 324 <!-- API PAGE --> 325 <div class="apiPage"> 326 <a name="apiReference"></a> 327 <h2>API reference: chrome.idle</h2> 328 329 <!-- PROPERTIES --> 330 <div class="apiGroup" style="display: none; "> 331 <a name="properties"></a> 332 <h3 id="properties">Properties</h3> 333 334 <div> 335 <a></a> 336 <h4>getLastError</h4> 337 <div class="summary"> 338 <!-- Note: intentionally longer 80 columns --> 339 <span>chrome.extension</span><span>lastError</span> 340 </div> 341 <div> 342 </div> 343 </div> 344 345 </div> <!-- /apiGroup --> 346 347 <!-- METHODS --> 348 <div class="apiGroup" id="methods"> 349 <a name="methods"></a> 350 <h3>Methods</h3> 351 352 <!-- iterates over all functions --> 353 <div class="apiItem"> 354 <a name="method-queryState"></a> <!-- method-anchor --> 355 <h4>queryState</h4> 356 357 <div class="summary"><span style="display: none; ">void</span> 358 <!-- Note: intentionally longer 80 columns --> 359 <span>chrome.idle.queryState</span>(<span class="null"><span style="display: none; ">, </span><span>integer</span> 360 <var><span>thresholdSeconds</span></var></span><span class="null"><span>, </span><span>function</span> 361 <var><span>callback</span></var></span>)</div> 362 363 <div class="description"> 364 <p class="todo" style="display: none; ">Undocumented.</p> 365 <p>Returns the current state of the browser.</p> 366 367 <!-- PARAMETERS --> 368 <h4>Parameters</h4> 369 <dl> 370 <div> 371 <div> 372 <dt> 373 <var>thresholdSeconds</var> 374 <em> 375 376 <!-- TYPE --> 377 <div style="display:inline"> 378 ( 379 <span class="optional" style="display: none; ">optional</span> 380 <span class="enum" style="display: none; ">enumerated</span> 381 <span id="typeTemplate"> 382 <span style="display: none; "> 383 <a> Type</a> 384 </span> 385 <span> 386 <span style="display: none; "> 387 array of <span><span></span></span> 388 </span> 389 <span>integer</span> 390 <span style="display: none; "></span> 391 </span> 392 </span> 393 ) 394 </div> 395 396 </em> 397 </dt> 398 <dd class="todo" style="display: none; "> 399 Undocumented. 400 </dd> 401 <dd>Threshold, in seconds, used to determine when a machine is in the idle state.</dd> 402 <dd style="display: none; "> 403 This parameter was added in version 404 <b><span></span></b>. 405 You must omit this parameter in earlier versions, 406 and you may omit it in any version. If you require this 407 parameter, the manifest key 408 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 409 can ensure that your extension won't be run in an earlier browser version. 410 </dd> 411 412 <!-- OBJECT PROPERTIES --> 413 <dd style="display: none; "> 414 <dl> 415 <div> 416 <div> 417 </div> 418 </div> 419 </dl> 420 </dd> 421 422 <!-- FUNCTION PARAMETERS --> 423 <dd style="display: none; "> 424 <div></div> 425 </dd> 426 427 </div> 428 </div><div> 429 <div> 430 <dt> 431 <var>callback</var> 432 <em> 433 434 <!-- TYPE --> 435 <div style="display:inline"> 436 ( 437 <span class="optional" style="display: none; ">optional</span> 438 <span class="enum" style="display: none; ">enumerated</span> 439 <span id="typeTemplate"> 440 <span style="display: none; "> 441 <a> Type</a> 442 </span> 443 <span> 444 <span style="display: none; "> 445 array of <span><span></span></span> 446 </span> 447 <span>function</span> 448 <span style="display: none; "></span> 449 </span> 450 </span> 451 ) 452 </div> 453 454 </em> 455 </dt> 456 <dd class="todo"> 457 Undocumented. 458 </dd> 459 <dd style="display: none; "> 460 Description of this parameter from the json schema. 461 </dd> 462 <dd style="display: none; "> 463 This parameter was added in version 464 <b><span></span></b>. 465 You must omit this parameter in earlier versions, 466 and you may omit it in any version. If you require this 467 parameter, the manifest key 468 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 469 can ensure that your extension won't be run in an earlier browser version. 470 </dd> 471 472 <!-- OBJECT PROPERTIES --> 473 <dd style="display: none; "> 474 <dl> 475 <div> 476 <div> 477 </div> 478 </div> 479 </dl> 480 </dd> 481 482 <!-- FUNCTION PARAMETERS --> 483 <dd style="display: none; "> 484 <div></div> 485 </dd> 486 487 </div> 488 </div> 489 </dl> 490 491 <!-- RETURNS --> 492 <h4 style="display: none; ">Returns</h4> 493 <dl> 494 <div style="display: none; "> 495 <div> 496 </div> 497 </div> 498 </dl> 499 500 <!-- CALLBACK --> 501 <div> 502 <div> 503 <h4>Callback function</h4> 504 <p> 505 The callback <em>parameter</em> should specify a function 506 that looks like this: 507 </p> 508 <p style="display: none; "> 509 If you specify the <em>callback</em> parameter, it should 510 specify a function that looks like this: 511 </p> 512 513 <!-- Note: intentionally longer 80 columns --> 514 <pre>function(<span>string newState</span>) <span class="subdued">{...}</span>;</pre> 515 <dl> 516 <div> 517 <div> 518 <dt> 519 <var>newState</var> 520 <em> 521 522 <!-- TYPE --> 523 <div style="display:inline"> 524 ( 525 <span class="optional" style="display: none; ">optional</span> 526 <span class="enum">enumerated</span> 527 <span id="typeTemplate"> 528 <span style="display: none; "> 529 <a> Type</a> 530 </span> 531 <span> 532 <span style="display: none; "> 533 array of <span><span></span></span> 534 </span> 535 <span>string</span> 536 <span>["active", "idle", "locked"]</span> 537 </span> 538 </span> 539 ) 540 </div> 541 542 </em> 543 </dt> 544 <dd class="todo"> 545 Undocumented. 546 </dd> 547 <dd style="display: none; "> 548 Description of this parameter from the json schema. 549 </dd> 550 <dd style="display: none; "> 551 This parameter was added in version 552 <b><span></span></b>. 553 You must omit this parameter in earlier versions, 554 and you may omit it in any version. If you require this 555 parameter, the manifest key 556 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 557 can ensure that your extension won't be run in an earlier browser version. 558 </dd> 559 560 <!-- OBJECT PROPERTIES --> 561 <dd style="display: none; "> 562 <dl> 563 <div> 564 <div> 565 </div> 566 </div> 567 </dl> 568 </dd> 569 570 <!-- FUNCTION PARAMETERS --> 571 <dd style="display: none; "> 572 <div></div> 573 </dd> 574 575 </div> 576 </div> 577 </dl> 578 </div> 579 </div> 580 581 <!-- MIN_VERSION --> 582 <p style="display: none; "> 583 This function was added in version <b><span></span></b>. 584 If you require this function, the manifest key 585 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 586 can ensure that your extension won't be run in an earlier browser version. 587 </p> 588 </div> <!-- /description --> 589 590 </div> <!-- /apiItem --> 591 592 </div> <!-- /apiGroup --> 593 594 <!-- EVENTS --> 595 <div class="apiGroup"> 596 <a name="events"></a> 597 <h3 id="events">Events</h3> 598 599 <!-- iterates over all events --> 600 <div class="apiItem"> 601 <a name="event-onStateChanged"></a> 602 <h4>onStateChanged</h4> 603 604 <div class="summary"> 605 <!-- Note: intentionally longer 80 columns --> 606 <span class="subdued">chrome.idle.</span><span>onStateChanged</span><span class="subdued">.addListener</span>(function(<span>string newState</span>) <span class="subdued">{...}</span>); 607 </div> 608 609 <div class="description"> 610 <p class="todo" style="display: none; ">Undocumented.</p> 611 <p>Fired when the browser changes to an active state. Currently only reports the transition from idle to active.</p> 612 613 <!-- PARAMETERS --> 614 <h4>Parameters</h4> 615 <dl> 616 <div> 617 <div> 618 <dt> 619 <var>newState</var> 620 <em> 621 622 <!-- TYPE --> 623 <div style="display:inline"> 624 ( 625 <span class="optional" style="display: none; ">optional</span> 626 <span class="enum">enumerated</span> 627 <span id="typeTemplate"> 628 <span style="display: none; "> 629 <a> Type</a> 630 </span> 631 <span> 632 <span style="display: none; "> 633 array of <span><span></span></span> 634 </span> 635 <span>string</span> 636 <span>["active"]</span> 637 </span> 638 </span> 639 ) 640 </div> 641 642 </em> 643 </dt> 644 <dd class="todo"> 645 Undocumented. 646 </dd> 647 <dd style="display: none; "> 648 Description of this parameter from the json schema. 649 </dd> 650 <dd style="display: none; "> 651 This parameter was added in version 652 <b><span></span></b>. 653 You must omit this parameter in earlier versions, 654 and you may omit it in any version. If you require this 655 parameter, the manifest key 656 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 657 can ensure that your extension won't be run in an earlier browser version. 658 </dd> 659 660 <!-- OBJECT PROPERTIES --> 661 <dd style="display: none; "> 662 <dl> 663 <div> 664 <div> 665 </div> 666 </div> 667 </dl> 668 </dd> 669 670 <!-- FUNCTION PARAMETERS --> 671 <dd style="display: none; "> 672 <div></div> 673 </dd> 674 675 </div> 676 </div> 677 </dl> 678 679 </div> <!-- /decription --> 680 681 </div> <!-- /apiItem --> 682 683 </div> <!-- /apiGroup --> 684 685 <!-- TYPES --> 686 <div class="apiGroup" style="display: none; "> 687 <a name="types"></a> 688 <h3 id="types">Types</h3> 689 690 <!-- iterates over all types --> 691 <div class="apiItem"> 692 <a></a> 693 <h4>type name</h4> 694 695 <div> 696 </div> 697 698 </div> <!-- /apiItem --> 699 700 </div> <!-- /apiGroup --> 701 702 </div> <!-- /apiPage --> 703 </div> <!-- /gc-pagecontent --> 704 </div> <!-- /g-section --> 705 </div> <!-- /codesiteContent --> 706 <div id="gc-footer" --=""> 707 <div class="text"> 708 <p> 709 Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>, 710 the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons 711 Attribution 3.0 License</a>, and code samples are licensed under the 712 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. 713 </p> 714 <p> 715 ©2010 Google 716 </p> 717 718<!-- begin analytics --> 719<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> 720<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script> 721 722<script type="text/javascript"> 723 // chrome doc tracking 724 try { 725 var engdocs = _gat._getTracker("YT-10763712-2"); 726 engdocs._trackPageview(); 727 } catch(err) {} 728 729 // code.google.com site-wide tracking 730 try { 731 _uacct="UA-18071-1"; 732 _uanchor=1; 733 _uff=0; 734 urchinTracker(); 735 } 736 catch(e) {/* urchinTracker not available. */} 737</script> 738<!-- end analytics --> 739 </div> 740 </div> <!-- /gc-footer --> 741 </div> <!-- /gc-container --> 742</body></html> 743