getSharedData
Description
Reads the in-memory shared app data stored with $app.setSharedData(). Returns null if the key doesn't exist.
Parameters
| Parameter | Type | Description |
|---|---|---|
| sharedKey | String | Key name of the data to read |
Returns
dynamic — the stored value, or null if there is none
Notes
- It reads straight from the app process memory, so it's fast.
- Values disappear when the app restarts (non-persistent). Use
$app.getStoreData()for values that must survive a restart.
Example
// Read the user info stored at login
var user = $app.getSharedData("currentUser");
if (user) {
$log.i(user.name);
}
Related
$app.setSharedData(sharedKey, data)$app.getStoreData(key)