Skip to content

Commit 53f750f

Browse files
committed
Add spec and configure codegen
1 parent 5c4072c commit 53f750f

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,13 @@
191191
}
192192
]
193193
]
194+
},
195+
"codegenConfig": {
196+
"name": "rnasyncstorage",
197+
"type": "modules",
198+
"jsSrcsDir": "./src",
199+
"android": {
200+
"javaPackageName": "com.reactnativecommunity.asyncstorage"
201+
}
194202
}
195203
}

src/NativeAsyncStorageModule.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { TurboModuleRegistry, TurboModule } from 'react-native';
2+
3+
export interface Spec extends TurboModule {
4+
multiGet: (
5+
keys: string[],
6+
callback: (error?: Object[], result?: [string, string][]) => void
7+
) => void;
8+
multiSet: (
9+
kvPairs: [string, string][],
10+
callback: (error?: Object[]) => void
11+
) => void;
12+
multiRemove: (
13+
keys: readonly string[],
14+
callback: (error?: Object[]) => void
15+
) => void;
16+
multiMerge: (
17+
kvPairs: [string, string][],
18+
callback: (error?: Object[]) => void
19+
) => void;
20+
getAllKeys: (
21+
callback: (error?: Object[], result?: [string, string][]) => void
22+
) => void;
23+
clear: (callback: (error?: Object[]) => void) => void;
24+
}
25+
26+
export default TurboModuleRegistry.get<Spec>('RNCAsyncStorage');

0 commit comments

Comments
 (0)