Skip to content

Commit 632f9d3

Browse files
committed
sig 打补丁
1 parent 4493e5e commit 632f9d3

File tree

2 files changed

+3
-41
lines changed

2 files changed

+3
-41
lines changed

package.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,7 @@
1717
"files": [
1818
"src",
1919
"lib",
20-
"android",
21-
"!android/build",
22-
"ios",
23-
"!ios/build",
24-
"harmony/exception_handler",
25-
"harmony/exception_handler.har",
26-
"!harmony/build",
27-
"!harmony/oh_modules",
28-
"dist",
29-
"ReactNativeExceptionHandler.podspec",
30-
"!**/__tests__",
31-
"!**/__fixtures__",
32-
"!**/__mocks__",
33-
"!**/.*"
20+
"harmony"
3421
],
3522
"scripts": {
3623
"bob": "bob build",

src/index.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,10 @@
2424

2525
import ExceptionHandlerTurboModule from './NativeExceptionHandler'
2626
import { Platform } from "react-native";
27+
export { setJSExceptionHandler, getJSExceptionHandler } from "react-native-exception-handler/index"
2728

2829
const noop = () => { };
2930

30-
export const setJSExceptionHandler = (handler = noop, allowedInDevMode = false) => {
31-
if (typeof allowedInDevMode !== "boolean" || typeof handler !== "function") {
32-
console.log("setJSExceptionHandler is called with wrong argument types.. first argument should be callback function and second argument is optional should be a boolean");
33-
console.log("Not setting the JS handler .. please fix setJSExceptionHandler call");
34-
return;
35-
}
36-
const allowed = allowedInDevMode ? true : !__DEV__;
37-
if (allowed) {
38-
ErrorUtils.setGlobalHandler(handler);
39-
const consoleError = console.error;
40-
console.error = (...args) => {
41-
consoleError(...args);
42-
};
43-
} else {
44-
console.log("Skipping setJSExceptionHandler: Reason: In DEV mode and allowedInDevMode = false");
45-
}
46-
};
47-
48-
export const getJSExceptionHandler = () => ErrorUtils.getGlobalHandler();
49-
5031
export const setNativeExceptionHandler = (handler = noop, forceAppQuit = true, executeDefaultHandler = false) => {
5132
if (typeof handler !== "function" || typeof forceAppQuit !== "boolean") {
5233
console.log("setNativeExceptionHandler is called with wrong argument types.. first argument should be callback function and second argument is optional should be a boolean");
@@ -61,10 +42,4 @@ export const setNativeExceptionHandler = (handler = noop, forceAppQuit = true, e
6142
} else {
6243
ExceptionHandlerTurboModule.setHandlerforNativeException(handler, forceAppQuit, executeDefaultHandler);
6344
}
64-
};
65-
66-
export default {
67-
setJSExceptionHandler,
68-
getJSExceptionHandler,
69-
setNativeExceptionHandler
70-
};
45+
};

0 commit comments

Comments
 (0)