UNPKG

@qcwx_mediatom/quick-app-ad-sdk

Version:

mediatom快应用广告SDK

33 lines (29 loc) 640 B
import storage from '@system.storage'; export const CACHE_KEYS = { DEVICE: 'ad_device_info', INSTALLED: 'ad_installed_apps', CONFIG: 'ad_app_config', UPDATETIME:'da_server_time', ADCONFIG:'ad_config', }; export function loadCache(key) { return new Promise(resolve => { storage.get({ key, success: res => { try { resolve(JSON.parse(res.data)); } catch { resolve(null); } }, fail: () => resolve(null) }); }); } export function saveCache(key, value) { storage.set({ key, value: JSON.stringify(value) }); }