1 | import { Platform } from 'expo-modules-core';
|
2 | const LOCAL_STORAGE_KEY = 'EXPO_ERROR_RECOVERY_STORAGE';
|
3 | function _consumeRecoveryProps() {
|
4 | if (!Platform.isDOMAvailable)
|
5 | return null;
|
6 | try {
|
7 | const props = localStorage.getItem(LOCAL_STORAGE_KEY);
|
8 | localStorage.removeItem(LOCAL_STORAGE_KEY);
|
9 | return props;
|
10 | }
|
11 | catch (e) {
|
12 |
|
13 | }
|
14 | return null;
|
15 | }
|
16 | export default {
|
17 | get name() {
|
18 | return 'ExpoErrorRecovery';
|
19 | },
|
20 | saveRecoveryProps(props) {
|
21 | if (!Platform.isDOMAvailable)
|
22 | return;
|
23 | try {
|
24 | localStorage.setItem(LOCAL_STORAGE_KEY, props);
|
25 | }
|
26 | catch (e) {
|
27 |
|
28 | }
|
29 | },
|
30 | recoveredProps: _consumeRecoveryProps(),
|
31 | };
|
32 |
|
\ | No newline at end of file |