fix: sources json view

This commit is contained in:
redhoodsu
2019-08-05 19:24:59 +08:00
parent 5d43dd29bb
commit 1f126d4877
4 changed files with 17 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ let worker
if (isWorkerSupported) {
tryIt(function() {
/* Some browsers like uc mobile doesn't destroy worker properly after refreshing.
* After a few times of visiting, it reaches the maximum number of workers per site.
* After a few times of visiting, it reaches the maximum number of workers per site.
*/
worker = new StringifyWorker()
worker.onmessage = function(e) {

View File

@@ -3,7 +3,15 @@ import beautify from 'js-beautify'
import highlight from '../lib/highlight'
import JsonViewer from '../lib/JsonViewer'
import Settings from '../Settings/Settings'
import { evalCss, ajax, isEmpty, escape, trim, isStr } from '../lib/util'
import {
evalCss,
ajax,
isEmpty,
escape,
trim,
isStr,
stringifyAll
} from '../lib/util'
export default class Sources extends Tool {
constructor() {
@@ -256,7 +264,10 @@ export default class Sources extends Tool {
let val = this._data.val
try {
if (isStr(val)) val = JSON.parse(val)
if (isStr(val)) {
val = JSON.parse(val)
val = stringifyAll(val)
}
/* eslint-disable no-empty */
} catch (e) {}

View File

@@ -32,7 +32,7 @@ import {
module.exports = {
init({ container, tool, autoScale = true, useShadowDom = true } = {}) {
if (this._isInit) return
this._isInit = true
this._scale = 1

View File

@@ -2,10 +2,10 @@ import { Logger } from './util'
let logger
export default (logger = new Logger(
export default logger = new Logger(
'[Eruda]',
ENV === 'production' ? 'warn' : 'debug'
))
)
logger.formatter = function(type, argList) {
argList.unshift(this.name)