| OLD | NEW |
| (Empty) |
| 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/jstempla
te_compiled.js"> | |
| 15 </script> | |
| 16 <script type="text/javascript" src="../../../../third_party/json_minify/mini
fy-sans-regexp.js"> | |
| 17 </script> | |
| 18 <script type="text/javascript" src="js/api_page_generator.js"></script> | |
| 19 <script type="text/javascript" src="js/bootstrap.js"></script> | |
| 20 <script type="text/javascript" src="js/sidebar.js"></script> | |
| 21 <meta name="description" content="Documentation for the chrome.storage module,
which is part of the Google Chrome extension APIs."><title>Storage - Google Ch
rome Extensions - Google Code</title></head> | |
| 22 <body> <div id="devModeWarning" class="displayModeWarning"> | |
| 23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp
ecting to see local changes when you refresh? You'll need run chrome with --allo
w-file-access-from-files. | |
| 24 </div> | |
| 25 <div id="branchWarning" class="displayModeWarning"> | |
| 26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation. | |
| 27 It may not work with the stable release of Chrome.</span> | |
| 28 <select id="branchChooser"> | |
| 29 <option>Choose a different version... | |
| 30 </option><option value="">Stable | |
| 31 </option><option value="beta">Beta | |
| 32 </option><option value="dev">Dev | |
| 33 </option><option value="trunk">Trunk | |
| 34 </option></select> | |
| 35 </div> | |
| 36 <div id="unofficialWarning" class="displayModeWarning"> | |
| 37 <span>WARNING: This is unofficial documentation. It may not work with the | |
| 38 current release of Chrome.</span> | |
| 39 <button id="goToOfficialDocs">Go to the official docs</button> | |
| 40 </div> | |
| 41 <div id="gc-container" class="labs"> | |
| 42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> | |
| 43 <!-- In particular, sub-templates that recurse, must be used by allowing | |
| 44 jstemplate to make a copy of the template in this section which | |
| 45 are not operated on by way of the jsskip="true" --> | |
| 46 <!-- /SUBTEMPLATES --> | |
| 47 <a id="top"></a> | |
| 48 <div id="skipto"> | |
| 49 <a href="#gc-pagecontent">Skip to page content</a> | |
| 50 <a href="#gc-toc">Skip to main navigation</a> | |
| 51 </div> | |
| 52 <!-- API HEADER --> | |
| 53 <table id="header" width="100%" cellspacing="0" border="0"> | |
| 54 <tbody><tr> | |
| 55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c
ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:
0; margin:0;"></a></td> | |
| 56 <td valign="middle" width="100%" style="padding-left:0.6em;"> | |
| 57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.
5em"> | |
| 58 <div id="gsc-search-box"> | |
| 59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz
fqtno"> | |
| 60 <input type="hidden" name="ie" value="UTF-8"> | |
| 61 <input type="text" name="q" value="" size="55"> | |
| 62 <input class="gsc-search-button" type="submit" name="sa" value="Se
arch"> | |
| 63 <br> | |
| 64 <span class="greytext">e.g. "page action" or "tabs"</span> | |
| 65 </div> | |
| 66 </form> | |
| 67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc
ript> | |
| 68 <script type="text/javascript">google.load("elements", "1", {packages:
"transliteration"});</script> | |
| 69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1
3n?form=cse&t13n_langs=en"></script> | |
| 70 <script type="text/javascript" src="https://www.google.com/coop/cse/br
and?form=cse&lang=en"></script> | |
| 71 </td> | |
| 72 </tr> | |
| 73 </tbody></table> | |
| 74 <div id="codesiteContent" class=""> | |
| 75 <a id="gc-topnav-anchor"></a> | |
| 76 <div id="gc-topnav"> | |
| 77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab
s</a>)</h1> | |
| 78 <ul id="home" class="gc-topnav-tabs"> | |
| 79 <li id="home_link"> | |
| 80 <a href="index.html" title="Google Chrome Extensions home page">Home
</a> | |
| 81 </li> | |
| 82 <li id="docs_link"> | |
| 83 <a href="docs.html" title="Official Google Chrome Extensions documen
tation">Docs</a> | |
| 84 </li> | |
| 85 <li id="faq_link"> | |
| 86 <a href="faq.html" title="Answers to frequently asked questions abou
t Google Chrome Extensions">FAQ</a> | |
| 87 </li> | |
| 88 <li id="samples_link"> | |
| 89 <a href="samples.html" title="Sample extensions (with source code)">
Samples</a> | |
| 90 </li> | |
| 91 <li id="group_link"> | |
| 92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte
nsions" title="Google Chrome Extensions developer forum">Group</a> | |
| 93 </li> | |
| 94 <li id="so_link"> | |
| 95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext
ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a> | |
| 96 </li> | |
| 97 </ul> | |
| 98 </div> <!-- end gc-topnav --> | |
| 99 <div class="g-section g-tpl-170"> | |
| 100 <!-- SIDENAV --> | |
| 101 <div class="g-unit g-first" id="gc-toc"> | |
| 102 <ul> | |
| 103 <li><a href="getstarted.html">Getting Started</a></li> | |
| 104 <li><a href="overview.html">Overview</a></li> | |
| 105 <li><a href="whats_new.html">What's New?</a></li> | |
| 106 <li><h2><a href="devguide.html">Developer's Guide</a></h2> | |
| 107 <ul> | |
| 108 <li>Browser UI | |
| 109 <ul> | |
| 110 <li><a href="browserAction.html">Browser Actions</a></li> | |
| 111 <li><a href="contextMenus.html">Context Menus</a></li> | |
| 112 <li><a href="notifications.html">Desktop Notifications</a></li
> | |
| 113 <li><a href="omnibox.html">Omnibox</a></li> | |
| 114 <li><a href="options.html">Options Pages</a></li> | |
| 115 <li><a href="override.html">Override Pages</a></li> | |
| 116 <li><a href="pageAction.html">Page Actions</a></li> | |
| 117 </ul> | |
| 118 </li> | |
| 119 <li>Browser Interaction | |
| 120 <ul> | |
| 121 <li><a href="bookmarks.html">Bookmarks</a></li> | |
| 122 <li><a href="cookies.html">Cookies</a></li> | |
| 123 <li><a href="devtools.html">Developer Tools</a></li> | |
| 124 <li><a href="events.html">Events</a></li> | |
| 125 <li><a href="history.html">History</a></li> | |
| 126 <li><a href="management.html">Management</a></li> | |
| 127 <li><a href="tabs.html">Tabs</a></li> | |
| 128 <li><a href="windows.html">Windows</a></li> | |
| 129 </ul> | |
| 130 </li> | |
| 131 <li>Implementation | |
| 132 <ul> | |
| 133 <li><a href="a11y.html">Accessibility</a></li> | |
| 134 <li><a href="background_pages.html">Background Pages</a></li> | |
| 135 <li><a href="content_scripts.html">Content Scripts</a></li> | |
| 136 <li><a href="xhr.html">Cross-Origin XHR</a></li> | |
| 137 <li><a href="i18n.html">Internationalization</a></li> | |
| 138 <li><a href="messaging.html">Message Passing</a></li> | |
| 139 <li><a href="permissions.html">Optional Permissions</a></li> | |
| 140 <li><a href="npapi.html">NPAPI Plugins</a></li> | |
| 141 </ul> | |
| 142 </li> | |
| 143 <li>Finishing | |
| 144 <ul> | |
| 145 <li><a href="hosting.html">Hosting</a></li> | |
| 146 <li><a href="external_extensions.html">Other Deployment Option
s</a></li> | |
| 147 </ul> | |
| 148 </li> | |
| 149 </ul> | |
| 150 </li> | |
| 151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> | |
| 152 <li><h2><a href="tutorials.html">Tutorials</a></h2> | |
| 153 <ul> | |
| 154 <li><a href="tut_debugging.html">Debugging</a></li> | |
| 155 <li><a href="tut_analytics.html">Google Analytics</a></li> | |
| 156 <li><a href="tut_oauth.html">OAuth</a></li> | |
| 157 </ul> | |
| 158 </li> | |
| 159 <li><h2>Reference</h2> | |
| 160 <ul> | |
| 161 <li>Formats | |
| 162 <ul> | |
| 163 <li><a href="manifest.html">Manifest Files</a></li> | |
| 164 <li><a href="match_patterns.html">Match Patterns</a></li> | |
| 165 </ul> | |
| 166 </li> | |
| 167 <li><a href="permission_warnings.html">Permission Warnings</a></li
> | |
| 168 <li><a href="api_index.html">chrome.* APIs</a></li> | |
| 169 <li><a href="api_other.html">Other APIs</a></li> | |
| 170 </ul> | |
| 171 </li> | |
| 172 <li><h2><a href="samples.html">Samples</a></h2></li> | |
| 173 <div class="line"> </div> | |
| 174 <li><h2>More</h2> | |
| 175 <ul> | |
| 176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm
l">Chrome Web Store</a></li> | |
| 177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu
ide.html">Hosted Apps</a></li> | |
| 178 <li><a href="themes.html">Themes</a></li> | |
| 179 </ul> | |
| 180 </li> | |
| 181 </ul> | |
| 182 </div> | |
| 183 <script> | |
| 184 initToggles(); | |
| 185 </script> | |
| 186 <div class="g-unit" id="gc-pagecontent"> | |
| 187 <div id="pageTitle"> | |
| 188 <h1 class="page_title">Storage</h1> | |
| 189 </div> | |
| 190 <!-- TABLE OF CONTENTS --> | |
| 191 <div id="toc"> | |
| 192 <h2>Contents</h2> | |
| 193 <ol> | |
| 194 <li> | |
| 195 <a href="#manifest">Manifest</a> | |
| 196 <ol> | |
| 197 </ol> | |
| 198 </li><li> | |
| 199 <a href="#using-sync">Usage</a> | |
| 200 <ol> | |
| 201 </ol> | |
| 202 </li><li> | |
| 203 <a href="#limits">Storage and throttling limits</a> | |
| 204 <ol> | |
| 205 </ol> | |
| 206 </li><li> | |
| 207 <a href="#examples">Examples</a> | |
| 208 <ol> | |
| 209 </ol> | |
| 210 </li> | |
| 211 <li> | |
| 212 <a href="#apiReference">API reference: chrome.storage</a> | |
| 213 <ol> | |
| 214 <li> | |
| 215 <a href="#properties">Properties</a> | |
| 216 <ol> | |
| 217 <li> | |
| 218 <a href="#property-sync">sync</a> | |
| 219 </li><li> | |
| 220 <a href="#property-local">local</a> | |
| 221 </li> | |
| 222 </ol> | |
| 223 </li> | |
| 224 <li> | |
| 225 <a href="#global-events">Events</a> | |
| 226 <ol> | |
| 227 <li> | |
| 228 <a href="#event-onChanged">onChanged</a> | |
| 229 </li> | |
| 230 </ol> | |
| 231 </li> | |
| 232 <li> | |
| 233 <a href="#types">Types</a> | |
| 234 <ol> | |
| 235 <li> | |
| 236 <a href="#type-StorageChange">StorageChange</a> | |
| 237 <ol> | |
| 238 </ol> | |
| 239 </li><li> | |
| 240 <a href="#type-StorageArea">StorageArea</a> | |
| 241 <ol> | |
| 242 <li> | |
| 243 <a href="#global-StorageArea-methods">Methods</a> | |
| 244 <ol> | |
| 245 <li> | |
| 246 <a href="#method-StorageArea-clear">clear</a> | |
| 247 </li><li> | |
| 248 <a href="#method-StorageArea-get">get</a> | |
| 249 </li><li> | |
| 250 <a href="#method-StorageArea-getBytesInUse">getBytesInUse</a> | |
| 251 </li><li> | |
| 252 <a href="#method-StorageArea-remove">remove</a> | |
| 253 </li><li> | |
| 254 <a href="#method-StorageArea-set">set</a> | |
| 255 </li> | |
| 256 </ol> | |
| 257 </li> | |
| 258 </ol> | |
| 259 </li> | |
| 260 </ol> | |
| 261 </li> | |
| 262 </ol> | |
| 263 </li> | |
| 264 </ol> | |
| 265 </div> | |
| 266 <!-- /TABLE OF CONTENTS --> | |
| 267 <!-- Standard content lead-in for experimental API pages --> | |
| 268 <!-- STATIC CONTENT PLACEHOLDER --> | |
| 269 <div id="static"><div id="pageData-name" class="pageData">Storage</div> | |
| 270 <!-- BEGIN AUTHORED CONTENT --> | |
| 271 <p id="classSummary"> | |
| 272 Use the <code>chrome.storage</code> module | |
| 273 to store, retrieve, and track changes to user data. | |
| 274 This API has been optimized | |
| 275 to meet the specific storage needs of extensions. | |
| 276 It provides the same storage capabilities as the | |
| 277 <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage
API</a> | |
| 278 with the following key differences: | |
| 279 </p> | |
| 280 <ul> | |
| 281 <li>User data can be automatically synced with Chrome sync | |
| 282 (using <code>storage.sync</code>).</li> | |
| 283 <li>Your extension's content scripts can directly access user data | |
| 284 without the need for a background page.</li> | |
| 285 <li>A user's extension settings can be persisted | |
| 286 even when using | |
| 287 <a href="http://code.google.com/chrome/extensions/manifest.html#incognito">spl
it incognito behavior</a>.</li> | |
| 288 <li>User data can be stored as objects | |
| 289 (the <code>localStorage API</code> stores data in strings).</li> | |
| 290 </ul> | |
| 291 <h2 id="manifest">Manifest</h2> | |
| 292 <p>You must declare the "storage" permission in the <a href="manifest.html">exte
nsion manifest</a> | |
| 293 to use the storage API. | |
| 294 For example:</p> | |
| 295 <pre>{ | |
| 296 "name": "My extension", | |
| 297 ... | |
| 298 <b>"permissions": [ | |
| 299 "storage" | |
| 300 ]</b>, | |
| 301 ... | |
| 302 }</pre> | |
| 303 <h2 id="using-sync">Usage</h2> | |
| 304 <p> | |
| 305 To store user data for your extension, | |
| 306 you can use either | |
| 307 <code>storage.sync</code> or | |
| 308 <code>storage.local</code>. | |
| 309 When using <code>storage.sync</code>, | |
| 310 the stored data will automatically be synced | |
| 311 to any Chrome browser that the user is logged into, | |
| 312 provided the user has sync enabled. | |
| 313 </p> | |
| 314 <p> | |
| 315 When Chrome is offline, | |
| 316 Chrome stores the data locally. | |
| 317 The next time the browser is online, | |
| 318 Chrome syncs the data. | |
| 319 Even if a user disables syncing, | |
| 320 <code>storage.sync</code> will still work. | |
| 321 In this case, it will behave identically | |
| 322 to <code>storage.local</code>. | |
| 323 </p> | |
| 324 <p class="warning"> | |
| 325 Confidential user information should not be stored! | |
| 326 The storage area isn't encrypted. | |
| 327 </p> | |
| 328 <h2 id="limits">Storage and throttling limits</h2> | |
| 329 <p><code>chrome.storage</code> is not a big truck. | |
| 330 It's a series of tubes. | |
| 331 And if you don't understand, | |
| 332 those tubes can be filled, | |
| 333 and if they are filled | |
| 334 when you put your message in, | |
| 335 it gets in line, | |
| 336 and it's going to be delayed | |
| 337 by anyone that puts into that tube | |
| 338 enormous amounts of material. | |
| 339 </p><p>For details on the current limits | |
| 340 of the storage API, and what happens | |
| 341 when those limits are exceeded, please | |
| 342 see the <a href="#apiReference">API reference</a>. | |
| 343 </p><h2 id="examples">Examples</h2> | |
| 344 <p> | |
| 345 The following example checks for | |
| 346 CSS code saved by a user on a form, | |
| 347 and if found, | |
| 348 stores it. | |
| 349 </p> | |
| 350 <pre>function saveChanges() { | |
| 351 // Get a value saved in a form. | |
| 352 var theValue = textarea.value; | |
| 353 // Check that there's some code there. | |
| 354 if (!theValue) { | |
| 355 message('Error: No value specified'); | |
| 356 return; | |
| 357 } | |
| 358 // Save it using the Chrome extension storage API. | |
| 359 chrome.storage.sync.set({'value': theValue}, function() { | |
| 360 // Notify that we saved. | |
| 361 message('Settings saved'); | |
| 362 }); | |
| 363 } | |
| 364 </pre> | |
| 365 <p> | |
| 366 If you're interested in tracking changes made | |
| 367 to a data object, | |
| 368 you can add a listener | |
| 369 to its <code>onChanged</code> event. | |
| 370 Whenever anything changes in storage, | |
| 371 that event fires. | |
| 372 Here's sample code | |
| 373 to listen for saved changes: | |
| 374 </p> | |
| 375 <pre>chrome.storage.onChanged.addListener(function(changes, namespace) { | |
| 376 for (key in changes) { | |
| 377 var storageChange = changes[key]; | |
| 378 console.log('Storage key "%s" in namespace "%s" changed. ' + | |
| 379 'Old value was "%s", new value is "%s".', | |
| 380 key, | |
| 381 namespace, | |
| 382 storageChange.oldValue, | |
| 383 storageChange.newValue); | |
| 384 } | |
| 385 }); | |
| 386 </pre> | |
| 387 <p> | |
| 388 You can find examples that use this API on the | |
| 389 <a href="samples.html#sty">Samples page</a>. | |
| 390 </p> | |
| 391 <!-- END AUTHORED CONTENT --> | |
| 392 </div> | |
| 393 <!-- API PAGE --> | |
| 394 <div class="apiPage"> | |
| 395 <a name="apiReference"></a> | |
| 396 <h2>API reference: chrome.storage</h2> | |
| 397 <!-- PROPERTIES --> | |
| 398 <div class="apiGroup"> | |
| 399 <a name="properties"></a> | |
| 400 <h3 id="properties">Properties</h3> | |
| 401 <div> | |
| 402 <a name="property-sync"></a> | |
| 403 <h4>sync</h4> | |
| 404 <div class="summary"> | |
| 405 <!-- Note: intentionally longer 80 columns --> | |
| 406 <span>chrome.storage.</span><span>sync</span> | |
| 407 </div> | |
| 408 <div> | |
| 409 <dt> | |
| 410 <var>sync</var> | |
| 411 <em> | |
| 412 <!-- TYPE --> | |
| 413 <div style="display:inline"> | |
| 414 ( | |
| 415 <span id="typeTemplate"> | |
| 416 <span> | |
| 417 <a href="storage.html#type-StorageArea">StorageArea</a> | |
| 418 </span> | |
| 419 </span> | |
| 420 ) | |
| 421 </div> | |
| 422 </em> | |
| 423 </dt> | |
| 424 <dd>Items under the "sync" namespace are synced using Chrome Sync.</dd
> | |
| 425 <!-- OBJECT PROPERTIES --> | |
| 426 <dd> | |
| 427 <dl> | |
| 428 <div> | |
| 429 <div> | |
| 430 <dt> | |
| 431 <var>QUOTA_BYTES</var> | |
| 432 <em> | |
| 433 <!-- TYPE --> | |
| 434 <div style="display:inline"> | |
| 435 ( | |
| 436 <span id="typeTemplate"> | |
| 437 <code>102,400</code> | |
| 438 </span> | |
| 439 ) | |
| 440 </div> | |
| 441 </em> | |
| 442 </dt> | |
| 443 <dd>The maximum total amount (in bytes) of data that can be stored in
sync storage. Updates that would cause this limit to be exceeded fail immediatel
y and set chrome.extension.lastError.</dd> | |
| 444 <!-- OBJECT PROPERTIES --> | |
| 445 <!-- OBJECT METHODS --> | |
| 446 <!-- OBJECT EVENT FIELDS --> | |
| 447 <!-- FUNCTION PARAMETERS --> | |
| 448 </div> | |
| 449 </div><div> | |
| 450 <div> | |
| 451 <dt> | |
| 452 <var>QUOTA_BYTES_PER_ITEM</var> | |
| 453 <em> | |
| 454 <!-- TYPE --> | |
| 455 <div style="display:inline"> | |
| 456 ( | |
| 457 <span id="typeTemplate"> | |
| 458 <code>2,048</code> | |
| 459 </span> | |
| 460 ) | |
| 461 </div> | |
| 462 </em> | |
| 463 </dt> | |
| 464 <dd>The maximum size (in bytes) of each individual item in sync storag
e. Updates containing items larger than this limit will fail.</dd> | |
| 465 <!-- OBJECT PROPERTIES --> | |
| 466 <!-- OBJECT METHODS --> | |
| 467 <!-- OBJECT EVENT FIELDS --> | |
| 468 <!-- FUNCTION PARAMETERS --> | |
| 469 </div> | |
| 470 </div><div> | |
| 471 <div> | |
| 472 <dt> | |
| 473 <var>MAX_ITEMS</var> | |
| 474 <em> | |
| 475 <!-- TYPE --> | |
| 476 <div style="display:inline"> | |
| 477 ( | |
| 478 <span id="typeTemplate"> | |
| 479 <code>512</code> | |
| 480 </span> | |
| 481 ) | |
| 482 </div> | |
| 483 </em> | |
| 484 </dt> | |
| 485 <dd>The maximum number of items that can be stored in sync storage. Up
dates that would cause this limit to be exceeded will fail</dd> | |
| 486 <!-- OBJECT PROPERTIES --> | |
| 487 <!-- OBJECT METHODS --> | |
| 488 <!-- OBJECT EVENT FIELDS --> | |
| 489 <!-- FUNCTION PARAMETERS --> | |
| 490 </div> | |
| 491 </div><div> | |
| 492 <div> | |
| 493 <dt> | |
| 494 <var>MAX_WRITE_OPERATIONS_PER_HOUR</var> | |
| 495 <em> | |
| 496 <!-- TYPE --> | |
| 497 <div style="display:inline"> | |
| 498 ( | |
| 499 <span id="typeTemplate"> | |
| 500 <code>1,000</code> | |
| 501 </span> | |
| 502 ) | |
| 503 </div> | |
| 504 </em> | |
| 505 </dt> | |
| 506 <dd>The maximum number of <code>set</code>, <code>remove</code>, or <c
ode>clear</code> operations that can be performed each hour. Updates that would
cause this limit to be exceeded fail.</dd> | |
| 507 <!-- OBJECT PROPERTIES --> | |
| 508 <!-- OBJECT METHODS --> | |
| 509 <!-- OBJECT EVENT FIELDS --> | |
| 510 <!-- FUNCTION PARAMETERS --> | |
| 511 </div> | |
| 512 </div><div> | |
| 513 <div> | |
| 514 <dt> | |
| 515 <var>MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE</var> | |
| 516 <em> | |
| 517 <!-- TYPE --> | |
| 518 <div style="display:inline"> | |
| 519 ( | |
| 520 <span id="typeTemplate"> | |
| 521 <code>10</code> | |
| 522 </span> | |
| 523 ) | |
| 524 </div> | |
| 525 </em> | |
| 526 </dt> | |
| 527 <dd>The maximum number of <code>set</code>, <code>remove</code>, or <c
ode>clear</code> operations that can be performed each minute, sustained over 10
minutes. Updates that would cause this limit to be exceeded fail.</dd> | |
| 528 <!-- OBJECT PROPERTIES --> | |
| 529 <!-- OBJECT METHODS --> | |
| 530 <!-- OBJECT EVENT FIELDS --> | |
| 531 <!-- FUNCTION PARAMETERS --> | |
| 532 </div> | |
| 533 </div> | |
| 534 </dl> | |
| 535 </dd> | |
| 536 <!-- OBJECT METHODS --> | |
| 537 <!-- OBJECT EVENT FIELDS --> | |
| 538 <!-- FUNCTION PARAMETERS --> | |
| 539 </div> | |
| 540 </div><div> | |
| 541 <a name="property-local"></a> | |
| 542 <h4>local</h4> | |
| 543 <div class="summary"> | |
| 544 <!-- Note: intentionally longer 80 columns --> | |
| 545 <span>chrome.storage.</span><span>local</span> | |
| 546 </div> | |
| 547 <div> | |
| 548 <dt> | |
| 549 <var>local</var> | |
| 550 <em> | |
| 551 <!-- TYPE --> | |
| 552 <div style="display:inline"> | |
| 553 ( | |
| 554 <span id="typeTemplate"> | |
| 555 <span> | |
| 556 <a href="storage.html#type-StorageArea">StorageArea</a> | |
| 557 </span> | |
| 558 </span> | |
| 559 ) | |
| 560 </div> | |
| 561 </em> | |
| 562 </dt> | |
| 563 <dd>Items under the "local" namespace are local to each machine.</dd> | |
| 564 <!-- OBJECT PROPERTIES --> | |
| 565 <dd> | |
| 566 <dl> | |
| 567 <div> | |
| 568 <div> | |
| 569 <dt> | |
| 570 <var>QUOTA_BYTES</var> | |
| 571 <em> | |
| 572 <!-- TYPE --> | |
| 573 <div style="display:inline"> | |
| 574 ( | |
| 575 <span id="typeTemplate"> | |
| 576 <code>5,242,880</code> | |
| 577 </span> | |
| 578 ) | |
| 579 </div> | |
| 580 </em> | |
| 581 </dt> | |
| 582 <dd>The maximum amount (in bytes) of data that can be stored in local
storage. This value will be ignored if the extension has the <code>unlimitedStor
age</code> permission. Updates that would cause this limit to be exceeded fail.<
/dd> | |
| 583 <!-- OBJECT PROPERTIES --> | |
| 584 <!-- OBJECT METHODS --> | |
| 585 <!-- OBJECT EVENT FIELDS --> | |
| 586 <!-- FUNCTION PARAMETERS --> | |
| 587 </div> | |
| 588 </div> | |
| 589 </dl> | |
| 590 </dd> | |
| 591 <!-- OBJECT METHODS --> | |
| 592 <!-- OBJECT EVENT FIELDS --> | |
| 593 <!-- FUNCTION PARAMETERS --> | |
| 594 </div> | |
| 595 </div> | |
| 596 </div> <!-- /apiGroup --> | |
| 597 <!-- METHODS --> | |
| 598 <!-- /apiGroup --> | |
| 599 <!-- EVENTS --> | |
| 600 <div id="eventsTemplate" class="apiGroup"> | |
| 601 <a name="global-events"></a> | |
| 602 <h3>Events</h3> | |
| 603 <!-- iterates over all events --> | |
| 604 <div class="apiItem"> | |
| 605 <a name="event-onChanged"></a> | |
| 606 <h4>onChanged</h4> | |
| 607 <div class="summary"> | |
| 608 <!-- Note: intentionally longer 80 columns --> | |
| 609 <span class="subdued">chrome.storage.</span><span>onChanged</spa
n><span class="subdued">.addListener</span>(function(<span>object changes, strin
g namespace</span>) <span class="subdued">{...}</span><span></span>); | |
| 610 </div> | |
| 611 <div class="description"> | |
| 612 <p>Fired when one or more items change.</p> | |
| 613 <!-- LISTENER PARAMETERS --> | |
| 614 <div> | |
| 615 <h4>Listener parameters</h4> | |
| 616 <dl> | |
| 617 <div> | |
| 618 <div> | |
| 619 <dt> | |
| 620 <var>changes</var> | |
| 621 <em> | |
| 622 <!-- TYPE --> | |
| 623 <div style="display:inline"> | |
| 624 ( | |
| 625 <span id="typeTemplate"> | |
| 626 <span> | |
| 627 <span>object</span> | |
| 628 </span> | |
| 629 </span> | |
| 630 ) | |
| 631 </div> | |
| 632 </em> | |
| 633 </dt> | |
| 634 <dd>Object mapping each key that changed to its corresponding <a href=
"#type-StorageChange">StorageChange</a> for that item.</dd> | |
| 635 <!-- OBJECT PROPERTIES --> | |
| 636 <!-- OBJECT METHODS --> | |
| 637 <!-- OBJECT EVENT FIELDS --> | |
| 638 <!-- FUNCTION PARAMETERS --> | |
| 639 </div> | |
| 640 </div><div> | |
| 641 <div> | |
| 642 <dt> | |
| 643 <var>namespace</var> | |
| 644 <em> | |
| 645 <!-- TYPE --> | |
| 646 <div style="display:inline"> | |
| 647 ( | |
| 648 <span id="typeTemplate"> | |
| 649 <span> | |
| 650 <span>string</span> | |
| 651 </span> | |
| 652 </span> | |
| 653 ) | |
| 654 </div> | |
| 655 </em> | |
| 656 </dt> | |
| 657 <dd>The namespace ("sync" or "local") of the storage area the changes
are for.</dd> | |
| 658 <!-- OBJECT PROPERTIES --> | |
| 659 <!-- OBJECT METHODS --> | |
| 660 <!-- OBJECT EVENT FIELDS --> | |
| 661 <!-- FUNCTION PARAMETERS --> | |
| 662 </div> | |
| 663 </div> | |
| 664 </dl> | |
| 665 </div> | |
| 666 <!-- EXTRA PARAMETERS --> | |
| 667 <!-- LISTENER RETURN VALUE --> | |
| 668 <dl> | |
| 669 </dl> | |
| 670 </div> <!-- /description --> | |
| 671 <!-- /description --> | |
| 672 </div> <!-- /apiItem --> | |
| 673 </div> <!-- /apiGroup --> | |
| 674 <!-- TYPES --> | |
| 675 <div class="apiGroup"> | |
| 676 <a name="types"></a> | |
| 677 <h3 id="types">Types</h3> | |
| 678 <!-- iterates over all types --> | |
| 679 <div class="apiItem"> | |
| 680 <a name="type-StorageChange"></a> | |
| 681 <h4>StorageChange</h4> | |
| 682 <div> | |
| 683 <dt> | |
| 684 <em> | |
| 685 <!-- TYPE --> | |
| 686 <div style="display:inline"> | |
| 687 ( | |
| 688 <span id="typeTemplate"> | |
| 689 <span> | |
| 690 <span>object</span> | |
| 691 </span> | |
| 692 </span> | |
| 693 ) | |
| 694 </div> | |
| 695 </em> | |
| 696 </dt> | |
| 697 <dd class="todo"> | |
| 698 Undocumented. | |
| 699 </dd> | |
| 700 <!-- OBJECT PROPERTIES --> | |
| 701 <dd> | |
| 702 <dl> | |
| 703 <div> | |
| 704 <div> | |
| 705 <dt> | |
| 706 <var>oldValue</var> | |
| 707 <em> | |
| 708 <!-- TYPE --> | |
| 709 <div style="display:inline"> | |
| 710 ( | |
| 711 <span class="optional">optional</span> | |
| 712 <span id="typeTemplate"> | |
| 713 <span> | |
| 714 <span>any</span> | |
| 715 </span> | |
| 716 </span> | |
| 717 ) | |
| 718 </div> | |
| 719 </em> | |
| 720 </dt> | |
| 721 <dd>The old value of the item, if there was an old value.</dd> | |
| 722 <!-- OBJECT PROPERTIES --> | |
| 723 <!-- OBJECT METHODS --> | |
| 724 <!-- OBJECT EVENT FIELDS --> | |
| 725 <!-- FUNCTION PARAMETERS --> | |
| 726 </div> | |
| 727 </div><div> | |
| 728 <div> | |
| 729 <dt> | |
| 730 <var>newValue</var> | |
| 731 <em> | |
| 732 <!-- TYPE --> | |
| 733 <div style="display:inline"> | |
| 734 ( | |
| 735 <span class="optional">optional</span> | |
| 736 <span id="typeTemplate"> | |
| 737 <span> | |
| 738 <span>any</span> | |
| 739 </span> | |
| 740 </span> | |
| 741 ) | |
| 742 </div> | |
| 743 </em> | |
| 744 </dt> | |
| 745 <dd>The new value of the item, if there is a new value.</dd> | |
| 746 <!-- OBJECT PROPERTIES --> | |
| 747 <!-- OBJECT METHODS --> | |
| 748 <!-- OBJECT EVENT FIELDS --> | |
| 749 <!-- FUNCTION PARAMETERS --> | |
| 750 </div> | |
| 751 </div> | |
| 752 </dl> | |
| 753 </dd> | |
| 754 <!-- OBJECT METHODS --> | |
| 755 <!-- OBJECT EVENT FIELDS --> | |
| 756 <!-- FUNCTION PARAMETERS --> | |
| 757 </div> | |
| 758 </div><div class="apiItem"> | |
| 759 <a name="type-StorageArea"></a> | |
| 760 <h4>StorageArea</h4> | |
| 761 <div> | |
| 762 <dt> | |
| 763 <em> | |
| 764 <!-- TYPE --> | |
| 765 <div style="display:inline"> | |
| 766 ( | |
| 767 <span id="typeTemplate"> | |
| 768 <span> | |
| 769 <span>object</span> | |
| 770 </span> | |
| 771 </span> | |
| 772 ) | |
| 773 </div> | |
| 774 </em> | |
| 775 </dt> | |
| 776 <dd class="todo"> | |
| 777 Undocumented. | |
| 778 </dd> | |
| 779 <!-- OBJECT PROPERTIES --> | |
| 780 <!-- OBJECT METHODS --> | |
| 781 <dd> | |
| 782 <div class="apiGroup"> | |
| 783 <a name="global-StorageArea-methods"></a> | |
| 784 <h3>Methods of StorageArea</h3> | |
| 785 <!-- iterates over all functions --> | |
| 786 <div class="apiItem"> | |
| 787 <a name="method-StorageArea-clear"></a> <!-- method-anchor --> | |
| 788 <h4>clear</h4> | |
| 789 <div class="summary"> | |
| 790 <!-- Note: intentionally longer 80 columns --> | |
| 791 <span>storageArea.clear</span>(<span class="optional"><span>fu
nction</span> | |
| 792 <var><span>callback</span></var></span>)</div> | |
| 793 <div class="description"> | |
| 794 <p>Removes all items from storage.</p> | |
| 795 <!-- PARAMETERS --> | |
| 796 <h4>Parameters</h4> | |
| 797 <dl> | |
| 798 <div> | |
| 799 <div> | |
| 800 <dt> | |
| 801 <var>callback</var> | |
| 802 <em> | |
| 803 <!-- TYPE --> | |
| 804 <div style="display:inline"> | |
| 805 ( | |
| 806 <span class="optional">optional</span> | |
| 807 <span id="typeTemplate"> | |
| 808 <span> | |
| 809 <span>function</span> | |
| 810 </span> | |
| 811 </span> | |
| 812 ) | |
| 813 </div> | |
| 814 </em> | |
| 815 </dt> | |
| 816 <dd>Callback on success, or on failure (in which case <a href="extensi
on.html#property-lastError">chrome.extension.lastError</a> will be set).</dd> | |
| 817 <!-- OBJECT PROPERTIES --> | |
| 818 <!-- OBJECT METHODS --> | |
| 819 <!-- OBJECT EVENT FIELDS --> | |
| 820 <!-- FUNCTION PARAMETERS --> | |
| 821 </div> | |
| 822 </div> | |
| 823 </dl> | |
| 824 <!-- RETURNS --> | |
| 825 <dl> | |
| 826 </dl> | |
| 827 <!-- CALLBACK --> | |
| 828 <div> | |
| 829 <div> | |
| 830 <h4>Callback function</h4> | |
| 831 <p> | |
| 832 If you specify the <em>callback</em> parameter, it should | |
| 833 specify a function that looks like this: | |
| 834 </p> | |
| 835 <!-- Note: intentionally longer 80 columns --> | |
| 836 <pre>function(<span></span>) <span class="subdued">{...}</span
>;</pre> | |
| 837 <dl> | |
| 838 </dl> | |
| 839 </div> | |
| 840 </div> | |
| 841 <!-- MIN_VERSION --> | |
| 842 </div> <!-- /description --> | |
| 843 </div><div class="apiItem"> | |
| 844 <a name="method-StorageArea-get"></a> <!-- method-anchor --> | |
| 845 <h4>get</h4> | |
| 846 <div class="summary"> | |
| 847 <!-- Note: intentionally longer 80 columns --> | |
| 848 <span>storageArea.get</span>(<span class="optional"><span>stri
ng or array of string or object</span> | |
| 849 <var><span>keys</span></var></span><span class="null"><spa
n>, </span><span>function</span> | |
| 850 <var><span>callback</span></var></span>)</div> | |
| 851 <div class="description"> | |
| 852 <p>Gets one or more items from storage.</p> | |
| 853 <!-- PARAMETERS --> | |
| 854 <h4>Parameters</h4> | |
| 855 <dl> | |
| 856 <div> | |
| 857 <div> | |
| 858 <dt> | |
| 859 <var>keys</var> | |
| 860 <em> | |
| 861 <!-- TYPE --> | |
| 862 <div style="display:inline"> | |
| 863 ( | |
| 864 <span class="optional">optional</span> | |
| 865 <span id="typeTemplate"> | |
| 866 <span> | |
| 867 <span>string or array of string or object</span> | |
| 868 </span> | |
| 869 </span> | |
| 870 ) | |
| 871 </div> | |
| 872 </em> | |
| 873 </dt> | |
| 874 <dd>A single key to get, list of keys to get, or a dictionary specifyi
ng default values (see description of the object). An empty list or object will
return an empty result object. Pass in <code>null</code> to get the entire con
tents of storage.</dd> | |
| 875 <!-- OBJECT PROPERTIES --> | |
| 876 <!-- OBJECT METHODS --> | |
| 877 <!-- OBJECT EVENT FIELDS --> | |
| 878 <!-- FUNCTION PARAMETERS --> | |
| 879 </div> | |
| 880 </div><div> | |
| 881 <div> | |
| 882 <dt> | |
| 883 <var>callback</var> | |
| 884 <em> | |
| 885 <!-- TYPE --> | |
| 886 <div style="display:inline"> | |
| 887 ( | |
| 888 <span id="typeTemplate"> | |
| 889 <span> | |
| 890 <span>function</span> | |
| 891 </span> | |
| 892 </span> | |
| 893 ) | |
| 894 </div> | |
| 895 </em> | |
| 896 </dt> | |
| 897 <dd>Callback with storage items, or on failure (in which case <a href=
"extension.html#property-lastError">chrome.extension.lastError</a> will be set).
</dd> | |
| 898 <!-- OBJECT PROPERTIES --> | |
| 899 <!-- OBJECT METHODS --> | |
| 900 <!-- OBJECT EVENT FIELDS --> | |
| 901 <!-- FUNCTION PARAMETERS --> | |
| 902 </div> | |
| 903 </div> | |
| 904 </dl> | |
| 905 <!-- RETURNS --> | |
| 906 <dl> | |
| 907 </dl> | |
| 908 <!-- CALLBACK --> | |
| 909 <div> | |
| 910 <div> | |
| 911 <h4>Callback function</h4> | |
| 912 <p> | |
| 913 The <em>callback</em> parameter should specify a function | |
| 914 that looks like this: | |
| 915 </p> | |
| 916 <!-- Note: intentionally longer 80 columns --> | |
| 917 <pre>function(<span>object items</span>) <span class="subdued"
>{...}</span>;</pre> | |
| 918 <dl> | |
| 919 <div> | |
| 920 <div> | |
| 921 <dt> | |
| 922 <var>items</var> | |
| 923 <em> | |
| 924 <!-- TYPE --> | |
| 925 <div style="display:inline"> | |
| 926 ( | |
| 927 <span id="typeTemplate"> | |
| 928 <span> | |
| 929 <span>object</span> | |
| 930 </span> | |
| 931 </span> | |
| 932 ) | |
| 933 </div> | |
| 934 </em> | |
| 935 </dt> | |
| 936 <dd>Object with items in their key-value mappings.</dd> | |
| 937 <!-- OBJECT PROPERTIES --> | |
| 938 <!-- OBJECT METHODS --> | |
| 939 <!-- OBJECT EVENT FIELDS --> | |
| 940 <!-- FUNCTION PARAMETERS --> | |
| 941 </div> | |
| 942 </div> | |
| 943 </dl> | |
| 944 </div> | |
| 945 </div> | |
| 946 <!-- MIN_VERSION --> | |
| 947 </div> <!-- /description --> | |
| 948 </div><div class="apiItem"> | |
| 949 <a name="method-StorageArea-getBytesInUse"></a> <!-- method-anchor
--> | |
| 950 <h4>getBytesInUse</h4> | |
| 951 <div class="summary"> | |
| 952 <!-- Note: intentionally longer 80 columns --> | |
| 953 <span>storageArea.getBytesInUse</span>(<span class="optional">
<span>string or array of string</span> | |
| 954 <var><span>keys</span></var></span><span class="null"><spa
n>, </span><span>function</span> | |
| 955 <var><span>callback</span></var></span>)</div> | |
| 956 <div class="description"> | |
| 957 <p>Gets the amount of space (in bytes) being used by one or more
items.</p> | |
| 958 <!-- PARAMETERS --> | |
| 959 <h4>Parameters</h4> | |
| 960 <dl> | |
| 961 <div> | |
| 962 <div> | |
| 963 <dt> | |
| 964 <var>keys</var> | |
| 965 <em> | |
| 966 <!-- TYPE --> | |
| 967 <div style="display:inline"> | |
| 968 ( | |
| 969 <span class="optional">optional</span> | |
| 970 <span id="typeTemplate"> | |
| 971 <span> | |
| 972 <span>string or array of string</span> | |
| 973 </span> | |
| 974 </span> | |
| 975 ) | |
| 976 </div> | |
| 977 </em> | |
| 978 </dt> | |
| 979 <dd>A single key or list of keys to get the total usage for. An empty
list will return 0. Pass in <code>null</code> to get the total usage of all of s
torage.</dd> | |
| 980 <!-- OBJECT PROPERTIES --> | |
| 981 <!-- OBJECT METHODS --> | |
| 982 <!-- OBJECT EVENT FIELDS --> | |
| 983 <!-- FUNCTION PARAMETERS --> | |
| 984 </div> | |
| 985 </div><div> | |
| 986 <div> | |
| 987 <dt> | |
| 988 <var>callback</var> | |
| 989 <em> | |
| 990 <!-- TYPE --> | |
| 991 <div style="display:inline"> | |
| 992 ( | |
| 993 <span id="typeTemplate"> | |
| 994 <span> | |
| 995 <span>function</span> | |
| 996 </span> | |
| 997 </span> | |
| 998 ) | |
| 999 </div> | |
| 1000 </em> | |
| 1001 </dt> | |
| 1002 <dd>Callback with the amount of space being used by storage, or on fai
lure (in which case <a href="extension.html#property-lastError">chrome.extension
.lastError</a> will be set).</dd> | |
| 1003 <!-- OBJECT PROPERTIES --> | |
| 1004 <!-- OBJECT METHODS --> | |
| 1005 <!-- OBJECT EVENT FIELDS --> | |
| 1006 <!-- FUNCTION PARAMETERS --> | |
| 1007 </div> | |
| 1008 </div> | |
| 1009 </dl> | |
| 1010 <!-- RETURNS --> | |
| 1011 <dl> | |
| 1012 </dl> | |
| 1013 <!-- CALLBACK --> | |
| 1014 <div> | |
| 1015 <div> | |
| 1016 <h4>Callback function</h4> | |
| 1017 <p> | |
| 1018 The <em>callback</em> parameter should specify a function | |
| 1019 that looks like this: | |
| 1020 </p> | |
| 1021 <!-- Note: intentionally longer 80 columns --> | |
| 1022 <pre>function(<span>integer bytesInUse</span>) <span class="su
bdued">{...}</span>;</pre> | |
| 1023 <dl> | |
| 1024 <div> | |
| 1025 <div> | |
| 1026 <dt> | |
| 1027 <var>bytesInUse</var> | |
| 1028 <em> | |
| 1029 <!-- TYPE --> | |
| 1030 <div style="display:inline"> | |
| 1031 ( | |
| 1032 <span id="typeTemplate"> | |
| 1033 <span> | |
| 1034 <span>integer</span> | |
| 1035 </span> | |
| 1036 </span> | |
| 1037 ) | |
| 1038 </div> | |
| 1039 </em> | |
| 1040 </dt> | |
| 1041 <dd>Amount of space being used in storage, in bytes.</dd> | |
| 1042 <!-- OBJECT PROPERTIES --> | |
| 1043 <!-- OBJECT METHODS --> | |
| 1044 <!-- OBJECT EVENT FIELDS --> | |
| 1045 <!-- FUNCTION PARAMETERS --> | |
| 1046 </div> | |
| 1047 </div> | |
| 1048 </dl> | |
| 1049 </div> | |
| 1050 </div> | |
| 1051 <!-- MIN_VERSION --> | |
| 1052 </div> <!-- /description --> | |
| 1053 </div><div class="apiItem"> | |
| 1054 <a name="method-StorageArea-remove"></a> <!-- method-anchor --> | |
| 1055 <h4>remove</h4> | |
| 1056 <div class="summary"> | |
| 1057 <!-- Note: intentionally longer 80 columns --> | |
| 1058 <span>storageArea.remove</span>(<span class="null"><span>strin
g or array of string</span> | |
| 1059 <var><span>keys</span></var></span><span class="optional">
<span>, </span><span>function</span> | |
| 1060 <var><span>callback</span></var></span>)</div> | |
| 1061 <div class="description"> | |
| 1062 <p>Removes one or more items from storage.</p> | |
| 1063 <!-- PARAMETERS --> | |
| 1064 <h4>Parameters</h4> | |
| 1065 <dl> | |
| 1066 <div> | |
| 1067 <div> | |
| 1068 <dt> | |
| 1069 <var>keys</var> | |
| 1070 <em> | |
| 1071 <!-- TYPE --> | |
| 1072 <div style="display:inline"> | |
| 1073 ( | |
| 1074 <span id="typeTemplate"> | |
| 1075 <span> | |
| 1076 <span>string or array of string</span> | |
| 1077 </span> | |
| 1078 </span> | |
| 1079 ) | |
| 1080 </div> | |
| 1081 </em> | |
| 1082 </dt> | |
| 1083 <dd>A single key or a list of keys for items to remove.</dd> | |
| 1084 <!-- OBJECT PROPERTIES --> | |
| 1085 <!-- OBJECT METHODS --> | |
| 1086 <!-- OBJECT EVENT FIELDS --> | |
| 1087 <!-- FUNCTION PARAMETERS --> | |
| 1088 </div> | |
| 1089 </div><div> | |
| 1090 <div> | |
| 1091 <dt> | |
| 1092 <var>callback</var> | |
| 1093 <em> | |
| 1094 <!-- TYPE --> | |
| 1095 <div style="display:inline"> | |
| 1096 ( | |
| 1097 <span class="optional">optional</span> | |
| 1098 <span id="typeTemplate"> | |
| 1099 <span> | |
| 1100 <span>function</span> | |
| 1101 </span> | |
| 1102 </span> | |
| 1103 ) | |
| 1104 </div> | |
| 1105 </em> | |
| 1106 </dt> | |
| 1107 <dd>Callback on success, or on failure (in which case <a href="extensi
on.html#property-lastError">chrome.extension.lastError</a> will be set).</dd> | |
| 1108 <!-- OBJECT PROPERTIES --> | |
| 1109 <!-- OBJECT METHODS --> | |
| 1110 <!-- OBJECT EVENT FIELDS --> | |
| 1111 <!-- FUNCTION PARAMETERS --> | |
| 1112 </div> | |
| 1113 </div> | |
| 1114 </dl> | |
| 1115 <!-- RETURNS --> | |
| 1116 <dl> | |
| 1117 </dl> | |
| 1118 <!-- CALLBACK --> | |
| 1119 <div> | |
| 1120 <div> | |
| 1121 <h4>Callback function</h4> | |
| 1122 <p> | |
| 1123 If you specify the <em>callback</em> parameter, it should | |
| 1124 specify a function that looks like this: | |
| 1125 </p> | |
| 1126 <!-- Note: intentionally longer 80 columns --> | |
| 1127 <pre>function(<span></span>) <span class="subdued">{...}</span
>;</pre> | |
| 1128 <dl> | |
| 1129 </dl> | |
| 1130 </div> | |
| 1131 </div> | |
| 1132 <!-- MIN_VERSION --> | |
| 1133 </div> <!-- /description --> | |
| 1134 </div><div class="apiItem"> | |
| 1135 <a name="method-StorageArea-set"></a> <!-- method-anchor --> | |
| 1136 <h4>set</h4> | |
| 1137 <div class="summary"> | |
| 1138 <!-- Note: intentionally longer 80 columns --> | |
| 1139 <span>storageArea.set</span>(<span class="null"><span>object</
span> | |
| 1140 <var><span>items</span></var></span><span class="optional"
><span>, </span><span>function</span> | |
| 1141 <var><span>callback</span></var></span>)</div> | |
| 1142 <div class="description"> | |
| 1143 <p>Sets multiple items.</p> | |
| 1144 <!-- PARAMETERS --> | |
| 1145 <h4>Parameters</h4> | |
| 1146 <dl> | |
| 1147 <div> | |
| 1148 <div> | |
| 1149 <dt> | |
| 1150 <var>items</var> | |
| 1151 <em> | |
| 1152 <!-- TYPE --> | |
| 1153 <div style="display:inline"> | |
| 1154 ( | |
| 1155 <span id="typeTemplate"> | |
| 1156 <span> | |
| 1157 <span>object</span> | |
| 1158 </span> | |
| 1159 </span> | |
| 1160 ) | |
| 1161 </div> | |
| 1162 </em> | |
| 1163 </dt> | |
| 1164 <dd>Object specifying items to augment storage with. Values that canno
t be serialized (functions, etc) will be ignored.</dd> | |
| 1165 <!-- OBJECT PROPERTIES --> | |
| 1166 <!-- OBJECT METHODS --> | |
| 1167 <!-- OBJECT EVENT FIELDS --> | |
| 1168 <!-- FUNCTION PARAMETERS --> | |
| 1169 </div> | |
| 1170 </div><div> | |
| 1171 <div> | |
| 1172 <dt> | |
| 1173 <var>callback</var> | |
| 1174 <em> | |
| 1175 <!-- TYPE --> | |
| 1176 <div style="display:inline"> | |
| 1177 ( | |
| 1178 <span class="optional">optional</span> | |
| 1179 <span id="typeTemplate"> | |
| 1180 <span> | |
| 1181 <span>function</span> | |
| 1182 </span> | |
| 1183 </span> | |
| 1184 ) | |
| 1185 </div> | |
| 1186 </em> | |
| 1187 </dt> | |
| 1188 <dd>Callback on success, or on failure (in which case <a href="extensi
on.html#property-lastError">chrome.extension.lastError</a> will be set).</dd> | |
| 1189 <!-- OBJECT PROPERTIES --> | |
| 1190 <!-- OBJECT METHODS --> | |
| 1191 <!-- OBJECT EVENT FIELDS --> | |
| 1192 <!-- FUNCTION PARAMETERS --> | |
| 1193 </div> | |
| 1194 </div> | |
| 1195 </dl> | |
| 1196 <!-- RETURNS --> | |
| 1197 <dl> | |
| 1198 </dl> | |
| 1199 <!-- CALLBACK --> | |
| 1200 <div> | |
| 1201 <div> | |
| 1202 <h4>Callback function</h4> | |
| 1203 <p> | |
| 1204 If you specify the <em>callback</em> parameter, it should | |
| 1205 specify a function that looks like this: | |
| 1206 </p> | |
| 1207 <!-- Note: intentionally longer 80 columns --> | |
| 1208 <pre>function(<span></span>) <span class="subdued">{...}</span
>;</pre> | |
| 1209 <dl> | |
| 1210 </dl> | |
| 1211 </div> | |
| 1212 </div> | |
| 1213 <!-- MIN_VERSION --> | |
| 1214 </div> <!-- /description --> | |
| 1215 </div> <!-- /apiItem --> | |
| 1216 </div> | |
| 1217 </dd> | |
| 1218 <!-- OBJECT EVENT FIELDS --> | |
| 1219 <!-- FUNCTION PARAMETERS --> | |
| 1220 </div> | |
| 1221 </div> <!-- /apiItem --> | |
| 1222 </div> <!-- /apiGroup --> | |
| 1223 </div> <!-- /apiPage --> | |
| 1224 </div> <!-- /gc-pagecontent --> | |
| 1225 </div> <!-- /g-section --> | |
| 1226 </div> <!-- /codesiteContent --> | |
| 1227 <div id="gc-footer" --=""> | |
| 1228 <div class="text"> | |
| 1229 <p> | |
| 1230 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, | |
| 1231 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons | |
| 1232 Attribution 3.0 License</a>, and code samples are licensed under the | |
| 1233 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. | |
| 1234 </p> | |
| 1235 <p> | |
| 1236 ©2011 Google | |
| 1237 </p> | |
| 1238 <!-- begin analytics --> | |
| 1239 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script> | |
| 1240 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
ript> | |
| 1241 <script type="text/javascript"> | |
| 1242 // chrome doc tracking | |
| 1243 try { | |
| 1244 var engdocs = _gat._getTracker("YT-10763712-2"); | |
| 1245 engdocs._trackPageview(); | |
| 1246 } catch(err) {} | |
| 1247 // code.google.com site-wide tracking | |
| 1248 try { | |
| 1249 _uacct="UA-18071-1"; | |
| 1250 _uanchor=1; | |
| 1251 _uff=0; | |
| 1252 urchinTracker(); | |
| 1253 } | |
| 1254 catch(e) {/* urchinTracker not available. */} | |
| 1255 </script> | |
| 1256 <!-- end analytics --> | |
| 1257 </div> | |
| 1258 </div> <!-- /gc-footer --> | |
| 1259 </div> <!-- /gc-container --> | |
| 1260 </body></html> | |
| OLD | NEW |