@gathertown/uikit-react-native
Version:
Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
48 lines • 2.01 kB
JavaScript
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import { ASYNC_NOOP } from '@gathertown/uikit-utils';
export default class InternalLocalCacheStorage {
constructor(storage) {
this.storage = storage;
_defineProperty(this, "clear", ASYNC_NOOP);
_defineProperty(this, "flushGetRequests", ASYNC_NOOP);
}
getAllKeys() {
return this.storage.getAllKeys();
}
getItem(key) {
return this.storage.getItem(key);
}
removeItem(key) {
return this.storage.removeItem(key);
}
setItem(key, value) {
return this.storage.setItem(key, value);
}
async multiGet(keys) {
if (this.storage.multiGet) {
return this.storage.multiGet(keys);
} else {
return Promise.all(keys.map(async key => [key, await this.getItem(key)]));
}
}
async multiRemove(keys) {
if (this.storage.multiRemove) {
await this.storage.multiRemove(keys);
} else {
await Promise.all(keys.map(async key => this.removeItem(key)));
}
}
async multiSet(keyValuePairs) {
if (this.storage.multiSet) {
await this.storage.multiSet(keyValuePairs);
} else {
await Promise.all(keyValuePairs.map(_ref => {
let [key, value] = _ref;
return this.storage.setItem(key, value);
}));
}
}
}
//# sourceMappingURL=InternalLocalCacheStorage.js.map