UNPKG

taro-hooks

Version:
56 lines (55 loc) 1.3 kB
"use strict"; function _call(body, then, direct) { if (direct) { return then ? then(body()) : body(); } try { var result = Promise.resolve(body()); return then ? result.then(then) : result; } catch (e) { return Promise.reject(e); } } function _catch(body, recover) { try { var result = body(); } catch (e) { return recover(e); } if (result && result.then) { return result.then(void 0, recover); } return result; } function _async(f) { return function () { for (var args = [], i = 0; i < arguments.length; i++) { args[i] = arguments[i]; } try { return Promise.resolve(f.apply(this, args)); } catch (e) { return Promise.reject(e); } }; } Object.defineProperty(exports, "__esModule", { value: true }); var taro_1 = require("@tarojs/taro"); var spaceInfo_type_1 = require("./spaceInfo.type"); var getStorageSpaceInfo = _async(function () { return _catch(function () { return _call((0, taro_1.getStorageInfo), function (_ref) { var currentSize = _ref.currentSize, limitSize = _ref.limitSize; return { currentSize: currentSize, limitSize: limitSize }; }); }, function () { return spaceInfo_type_1.INIT; }); }); exports["default"] = getStorageSpaceInfo;