UNPKG

948 BJavaScriptView Raw
1import { Platform } from '@unimodules/core';
2const LOCAL_STORAGE_KEY = 'EXPO_ERROR_RECOVERY_STORAGE';
3function _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 // Catches localStorage SecurityError https://github.com/expo/expo/issues/8355
13 }
14 return null;
15}
16export 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 // Catches localStorage SecurityError https://github.com/expo/expo/issues/8355
28 }
29 },
30 recoveredProps: _consumeRecoveryProps(),
31};
32//# sourceMappingURL=ExpoErrorRecovery.web.js.map
\No newline at end of file