mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
Cleanup
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
const config = require('../babel.config');
|
||||
const config = require('../../babel.config');
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,4 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "react-native",
|
||||
rootDir: '..',
|
||||
};
|
||||
const config = require('../../jest.config');
|
||||
|
||||
module.exports = config;
|
||||
@@ -5,6 +5,9 @@
|
||||
"repository": {
|
||||
"url": "https://github.com/morten-olsen/react-native-debugger"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-native-json-tree": "^1.2.0",
|
||||
|
||||
@@ -65,12 +65,11 @@ class Log {
|
||||
}
|
||||
|
||||
attach(keep) {
|
||||
global.proxyConsole = proxyConsole;
|
||||
const redirected = Object.keys(proxyConsole).reduce((output, key) => ({
|
||||
...output,
|
||||
[key]: keep ? (...args) => proxyConsole[key](...args) : () => {},
|
||||
}), {});
|
||||
window.console = {
|
||||
global.console = {
|
||||
...redirected,
|
||||
error: (...data) => this.error(data, keep),
|
||||
warn: (...data) => this.warn(data, keep),
|
||||
@@ -79,12 +78,14 @@ class Log {
|
||||
debug: (...data) => this.debug(data, keep),
|
||||
verbose: (...data) => this.debug(data, keep),
|
||||
};
|
||||
if (global.ErrorUtils) {
|
||||
/*if (global.ErrorUtils) {
|
||||
global.ErrorUtils.setGlobalHandler((err, fatal) => {
|
||||
this.error([err], keep);
|
||||
});
|
||||
}*/
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener('error', this.handleError);
|
||||
}
|
||||
window.addEventListener('error', this.handleError);
|
||||
}
|
||||
|
||||
detach() {
|
||||
@@ -92,7 +93,9 @@ class Log {
|
||||
window.console[key] = proxies[key];
|
||||
});
|
||||
|
||||
window.removeEventListener('error', this.handleError);
|
||||
if (global.removeEventListener) {
|
||||
global.removeEventListener('error', this.handleError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@ import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import {
|
||||
DevTool,
|
||||
} from 'react-native-debug-console';
|
||||
import Console from 'react-native-debug-console/src/components/DevTool/Console';
|
||||
import ConsoleOutput, { Row as OutputRow} from 'react-native-debug-console/src/components/DevTool/Console/Output';
|
||||
import ConsoleInput from 'react-native-debug-console/src/components/DevTool/Console/Input';
|
||||
} from '../src';
|
||||
import Console from '../src/components/DevTool/Console';
|
||||
import ConsoleOutput, { Row as OutputRow} from '../src/components/DevTool/Console/Output';
|
||||
import ConsoleInput from '../src/components/DevTool/Console/Input';
|
||||
|
||||
import Requests from 'react-native-debug-console/src/components/DevTool/Requests';
|
||||
import RequestsDetails from 'react-native-debug-console/src/components/DevTool/Requests/Details';
|
||||
import RequestsList from 'react-native-debug-console/src/components/DevTool/Requests/List';
|
||||
import Requests from '../src/components/DevTool/Requests';
|
||||
import RequestsDetails from '../src/components/DevTool/Requests/Details';
|
||||
import RequestsList from '../src/components/DevTool/Requests/List';
|
||||
|
||||
import Storage from 'react-native-debug-console/src/components/DevTool/Storage';
|
||||
import StorageKeys from 'react-native-debug-console/src/components/DevTool/Storage/Keys';
|
||||
import StorageValues from 'react-native-debug-console/src/components/DevTool/Storage/Value';
|
||||
import Storage from '../src/components/DevTool/Storage';
|
||||
import StorageKeys from '../src/components/DevTool/Storage/Keys';
|
||||
import StorageValues from '../src/components/DevTool/Storage/Value';
|
||||
|
||||
const createLog = () => {
|
||||
const listeners = [];
|
||||
|
||||
Reference in New Issue
Block a user