OLD | NEW |
1 <h2 id="overview">Overview</h2> | 1 <h2 id="overview">Overview</h2> |
2 | 2 |
3 <p> | 3 <p> |
4 This API has been optimized | 4 This API has been optimized |
5 to meet the specific storage needs of extensions. | 5 to meet the specific storage needs of extensions. |
6 It provides the same storage capabilities as the | 6 It provides the same storage capabilities as the |
7 <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage
API</a> | 7 <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage
API</a> |
8 with the following key differences: | 8 with the following key differences: |
9 </p> | 9 </p> |
10 | 10 |
11 <ul> | 11 <ul> |
12 <li>User data can be automatically synced with Chrome sync | 12 <li>User data can be automatically synced with Chrome sync |
13 (using <code>storage.sync</code>).</li> | 13 (using <code>storage.sync</code>).</li> |
14 <li>Your extension's content scripts can directly access user data | 14 <li>Your extension's content scripts can directly access user data |
15 without the need for a background page.</li> | 15 without the need for a background page.</li> |
16 <li>A user's extension settings can be persisted | 16 <li>A user's extension settings can be persisted |
17 even when using | 17 even when using |
18 <a href="manifest.html#incognito">split incognito behavior</a>.</li> | 18 <a href="manifest/incognito.html">split incognito behavior</a>.</li> |
19 <li>It's asynchronous with bulk read and write operations, and therefore | 19 <li>It's asynchronous with bulk read and write operations, and therefore |
20 faster than the blocking and serial <code>localStorage API</code>. | 20 faster than the blocking and serial <code>localStorage API</code>. |
21 <li>User data can be stored as objects | 21 <li>User data can be stored as objects |
22 (the <code>localStorage API</code> stores data in strings).</li> | 22 (the <code>localStorage API</code> stores data in strings).</li> |
23 </ul> | 23 </ul> |
24 | 24 |
25 <h2 id="manifest">Manifest</h2> | 25 <h2 id="manifest">Manifest</h2> |
26 <p>You must declare the "storage" permission in the <a | 26 <p>You must declare the "storage" permission in the <a |
27 href="manifest.html">extension manifest</a> | 27 href="manifest.html">extension manifest</a> |
28 to use the storage API. | 28 to use the storage API. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 var storageChange = changes[key]; | 128 var storageChange = changes[key]; |
129 console.log('Storage key "%s" in namespace "%s" changed. ' + | 129 console.log('Storage key "%s" in namespace "%s" changed. ' + |
130 'Old value was "%s", new value is "%s".', | 130 'Old value was "%s", new value is "%s".', |
131 key, | 131 key, |
132 namespace, | 132 namespace, |
133 storageChange.oldValue, | 133 storageChange.oldValue, |
134 storageChange.newValue); | 134 storageChange.newValue); |
135 } | 135 } |
136 }); | 136 }); |
137 </pre> | 137 </pre> |
OLD | NEW |