removeStorage(params: Object)

版本要求:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { removeStorage } from '@ray-js/ray';

// Promise 调用
try {
  const res = await removeStorage({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

清理本地数据缓存

参数

属性类型必填说明
keystring是本地缓存中指定的 key
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success() => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

import { setStorage, removeStorage } from '@ray-js/ray'

// 删除本地缓存指定 key:先写入再删除
setStorage({
  key: "demoKey",
  data: "demoValue",
  success: () => {
    removeStorage({
      key: "demoKey",
      success: () => console.log("已删除 demoKey"),
      fail: error => console.error(error),
    });
  },
  fail: error => console.error(error),
});