my.setStorage.
Parameters
Code Example
Related APIs
my.setStorage
Store data asynchronously
my.getStorageSync
Get data synchronously
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Store data in local cache synchronously.
my.setStorage.
| Property | Type | Required | Description |
|---|---|---|---|
| key | String | Yes | Storage key identifier |
| data | Object/String | Yes | Data to store |
try {
my.setStorageSync({
key: 'token',
data: 'abc123'
});
console.log('Saved');
} catch (e) {
console.error('Save failed:', e);
}