阅读(3538) (0)

tt.getStorageSync

2020-02-12 11:07:03 更新
基础库 1.0.0 开始支持本方法,这是一个同步方法。

获取本地缓存数据。


参数 string

存储 key


输出 string

本地缓存数据类型


代码示例

try {
  const didShownAd = tt.getStorageSync("didShownAd");
  if (!didShownAd) {
    // request ad data
  }
} catch (error) {
  console.log(`getStorageSync调用失败`);
}