본문으로 건너뛰기

TudadaStore API

TudadaStore API (클라우드 스토리지)

디바이스와 무관하게 사용자 데이터를 클라우드에 저장/조회합니다.

용량 제한: value 최대 2KB

getTudadaStore()

TudadaStore 싱글톤 인스턴스를 반환합니다.

반환값:

필드타입설명
(반환값)TudadaStore클라우드 스토리지 인스턴스

인스턴스 메서드:

멤버타입설명
get(options)void클라우드에서 데이터 조회
save(options)void클라우드에 데이터 저장

store.get(options) 옵션:

파라미터타입필수설명
keystring조회할 키
successfunction-성공 콜백
failfunction-실패 콜백
completefunction-완료 콜백

store.get 성공 응답:

필드타입설명
valuestring | null저장된 값 (없으면 null)

store.save(options) 옵션:

파라미터타입필수설명
keystring저장할 키
valuestring저장할 값 (최대 2KB)
successfunction-성공 콜백
failfunction-실패 콜백
completefunction-완료 콜백
const store = TudadaSDK.getTudadaStore();

// 값 저장 (최대 2KB)
store.save({
key: 'userScore',
value: '1000',
success: () => console.log('클라우드 저장 완료'),
fail: (err) => console.error('저장 실패:', err.errMsg),
});

// 값 조회
store.get({
key: 'userScore',
success: (res) => {
if (res.value !== null) {
console.log('점수:', res.value);
} else {
console.log('저장된 값 없음');
}
},
});

tudadaStoreGet(options) / tudadaStoreSave(options)

TudadaStore를 직접 호출하는 방식입니다.

tudadaStoreSave(options) 옵션:

파라미터타입필수설명
keystring저장할 키
valuestring저장할 값 (최대 2KB)
successfunction-성공 콜백
failfunction-실패 콜백
completefunction-완료 콜백

tudadaStoreGet(options) 옵션:

파라미터타입필수설명
keystring조회할 키
successfunction-성공 콜백
failfunction-실패 콜백
completefunction-완료 콜백

tudadaStoreGet 성공 응답:

필드타입설명
valuestring | null저장된 값 (없으면 null)
// 저장
TudadaSDK.tudadaStoreSave({
key: 'gameState',
value: JSON.stringify({ level: 5, coins: 300 }),
success: () => console.log('저장 완료'),
fail: (err) => console.error('저장 실패:', err.errMsg),
});

// 조회
TudadaSDK.tudadaStoreGet({
key: 'gameState',
success: (res) => {
if (res.value) {
const state = JSON.parse(res.value);
console.log('레벨:', state.level);
}
},
});