5 * Library for storing device specific information. It should be used for storing simple
6 * strings and is not suitable for storing large chunks of data.
13 localStorage
: ( function () {
14 // Catch exceptions to avoid fatal in Chrome's "Block data storage" mode
15 // which throws when accessing the localStorage property itself, as opposed
16 // to the standard behaviour of throwing on getItem/setItem. (T148998)
18 return window
.localStorage
;
23 * Retrieve value from device storage.
25 * @param {string} key Key of item to retrieve
26 * @return {string|boolean} False when localStorage not available, otherwise string
28 get: function ( key
) {
30 return mw
.storage
.localStorage
.getItem( key
);
36 * Set a value in device storage.
38 * @param {string} key Key name to store under
39 * @param {string} value Value to be stored
40 * @return {boolean} Whether the save succeeded or not
42 set: function ( key
, value
) {
44 mw
.storage
.localStorage
.setItem( key
, value
);
51 * Remove a value from device storage.
53 * @param {string} key Key of item to remove
54 * @return {boolean} Whether the save succeeded or not
56 remove: function ( key
) {
58 mw
.storage
.localStorage
.removeItem( key
);