kutaisan-react-native-mmkv-storage
Version:
This library aims to provide a fast & reliable solution for you data storage needs in react-native apps. It uses [MMKV](https://github.com/Tencent/MMKV) by Tencent under the hood on Android and iOS both that is used by their WeChat app(more than 1 Billion
25 lines (22 loc) • 712 B
JavaScript
import stringsIndex from "./strings";
import numbersIndex from "./numbers";
import boolIndex from "./booleans";
import mapsIndex from "./maps";
import arrayIndex from "./arrays";
import { handleAction, handleActionAsync } from "../handlers";
export default class indexer {
constructor(id) {
this.instanceID = id;
this.strings = new stringsIndex(id);
this.numbers = new numbersIndex(id);
this.booleans = new boolIndex(id);
this.maps = new mapsIndex(id);
this.arrays = new arrayIndex(id);
}
async getKeys() {
return await handleActionAsync(global.getAllKeysMMKV, this.instanceID);
}
hasKey(key) {
return handleAction(global.containsKeyMMKV, key, this.instanceID);
}
}