mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
fix: sources json view
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
module.exports = {
|
||||
init({ container, tool, autoScale = true, useShadowDom = true } = {}) {
|
||||
if (this._isInit) return
|
||||
|
||||
|
||||
this._isInit = true
|
||||
this._scale = 1
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user