react-native-mmkv 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/android/CMakeLists.txt +3 -2
- package/ios/MmkvModule.mm +16 -14
- package/package.json +26 -2
- package/lib/commonjs/MMKV.js +0 -142
- package/lib/commonjs/MMKV.js.map +0 -1
- package/lib/commonjs/createMMKV.js +0 -66
- package/lib/commonjs/createMMKV.js.map +0 -1
- package/lib/commonjs/createMMKV.web.js +0 -70
- package/lib/commonjs/createMMKV.web.js.map +0 -1
- package/lib/commonjs/hooks.js +0 -176
- package/lib/commonjs/hooks.js.map +0 -1
- package/lib/commonjs/index.js +0 -32
- package/lib/commonjs/index.js.map +0 -1
- package/lib/module/MMKV.js +0 -131
- package/lib/module/MMKV.js.map +0 -1
- package/lib/module/createMMKV.js +0 -55
- package/lib/module/createMMKV.js.map +0 -1
- package/lib/module/createMMKV.web.js +0 -60
- package/lib/module/createMMKV.web.js.map +0 -1
- package/lib/module/hooks.js +0 -158
- package/lib/module/hooks.js.map +0 -1
- package/lib/module/index.js +0 -3
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/MMKV.d.ts +0 -130
- package/lib/typescript/createMMKV.d.ts +0 -6
- package/lib/typescript/createMMKV.web.d.ts +0 -2
- package/lib/typescript/hooks.d.ts +0 -63
- package/lib/typescript/index.d.ts +0 -2
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MMKV, MMKVConfiguration } from './MMKV';
|
|
3
|
-
export declare function useMMKV(configuration: MMKVConfiguration): React.RefObject<MMKV>;
|
|
4
|
-
/**
|
|
5
|
-
* Use the string value of the given `key` from the given MMKV storage instance.
|
|
6
|
-
*
|
|
7
|
-
* If no instance is provided, a shared default instance will be used.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const [username, setUsername] = useMMKVString("user.name")
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare const useMMKVString: (key: string, instance?: MMKV | undefined) => [value: string | undefined, setValue: (value: string | ((current: string | undefined) => string | undefined) | undefined) => void];
|
|
15
|
-
/**
|
|
16
|
-
* Use the number value of the given `key` from the given MMKV storage instance.
|
|
17
|
-
*
|
|
18
|
-
* If no instance is provided, a shared default instance will be used.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* const [age, setAge] = useMMKVNumber("user.age")
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const useMMKVNumber: (key: string, instance?: MMKV | undefined) => [value: number, setValue: (value: number | ((current: number) => number | undefined) | undefined) => void];
|
|
26
|
-
/**
|
|
27
|
-
* Use the boolean value of the given `key` from the given MMKV storage instance.
|
|
28
|
-
*
|
|
29
|
-
* If no instance is provided, a shared default instance will be used.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* const [isPremiumAccount, setIsPremiumAccount] = useMMKVBoolean("user.isPremium")
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare const useMMKVBoolean: (key: string, instance?: MMKV | undefined) => [value: boolean, setValue: (value: boolean | ((current: boolean) => boolean | undefined) | undefined) => void];
|
|
37
|
-
/**
|
|
38
|
-
* Use an object value of the given `key` from the given MMKV storage instance.
|
|
39
|
-
*
|
|
40
|
-
* If no instance is provided, a shared default instance will be used.
|
|
41
|
-
*
|
|
42
|
-
* The object will be serialized using `JSON`.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* const [user, setUser] = useMMKVObject<User>("user")
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function useMMKVObject<T>(key: string, instance?: MMKV): [value: T | undefined, setValue: (value: T | undefined) => void];
|
|
50
|
-
/**
|
|
51
|
-
* Listen for changes in the given MMKV storage instance.
|
|
52
|
-
* If no instance is passed, the default instance will be used.
|
|
53
|
-
* @param valueChangedListener The function to call whenever a value inside the storage instance changes
|
|
54
|
-
* @param instance The instance to listen to changes to (or the default instance)
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* useMMKVListener((key) => {
|
|
59
|
-
* console.log(`Value for "${key}" changed!`)
|
|
60
|
-
* })
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare function useMMKVListener(valueChangedListener: (key: string) => void, instance?: MMKV): void;
|