This repository was archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Local Storage
Paolo edited this page Oct 30, 2017
·
1 revision
Local Storage API allow to persist key-value pairs into the HTML5 Local Storage available in all modern Browsers.
The local storage content is persisted in the Browser across user's sessions; it can store up to 10 MB.
var KEY_SEARCHTEXT = "key.searchtext"; var searchText; // save the search text in localStorage plugins.webstorageLocalstorage.setItem(KEY_SEARCHTEXT, searchText); // the saved search text can be retrieved during the next user's session searchText = plugins.webstorageLocalstorage.getItem(KEY_SEARCHTEXT);
| Event | Params | Return | Description |
|---|---|---|---|
| setItem | key:String, value: String | Sets an item based on a key name and value. | |
| getItem | key:String | Returns the value of an item based on a key name. | |
| removeItem | key:String | Removes an item based on a key name. | |
| clear | Clears the entire local storage. | ||
| getLength | Number | Returns the length based on the amount of items. | |
| key | index:Number | Returns the name of a key based on an index. |