getSharedData
Description
$app.setSharedData()로 저장한 인메모리 앱 공유 데이터를 읽습니다. 키가 존재하지 않으면 null을 반환합니다.
Parameters
| 파라미터 | 타입 | 설명 |
|---|---|---|
| sharedKey | String | 조회할 데이터의 키 이름 |
Returns
dynamic — 저장된 값. 없으면 null
Notes
- 앱 프로세스 메모리에서 바로 읽으므로 빠릅니다.
- 앱을 재시작하면 값이 사라집니다(비영구). 재시작 후에도 유지되어야 하는 값은
$app.getStoreData()를 사용하세요.
Example
// 로그인 시 저장해둔 사용자 정보 읽기
var user = $app.getSharedData("currentUser");
if (user) {
$log.i(user.name);
}
Related
$app.setSharedData(sharedKey, data)$app.getStoreData(key)