mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-24 09:48:37 +08:00
Fix console show in sources panel
This commit is contained in:
@@ -39,8 +39,9 @@ export default class Console extends Tool {
|
||||
|
||||
CONSOLE_METHOD.forEach(name => {
|
||||
let origin = (origConsole[name] = noop)
|
||||
if (winConsole[name])
|
||||
if (winConsole[name]) {
|
||||
origin = origConsole[name] = winConsole[name].bind(winConsole)
|
||||
}
|
||||
|
||||
winConsole[name] = (...args) => {
|
||||
this[name](...args)
|
||||
|
||||
@@ -166,7 +166,7 @@ export default class Log {
|
||||
}
|
||||
this.formattedMsg = msg
|
||||
}
|
||||
static click(type, log, $el) {
|
||||
static click(type, log, $el, logger) {
|
||||
switch (type) {
|
||||
case 'log':
|
||||
case 'warn':
|
||||
@@ -176,7 +176,9 @@ export default class Log {
|
||||
case 'table':
|
||||
case 'dir':
|
||||
if (log.src) {
|
||||
if (Log.showSrcInSources) return 'viewSrc'
|
||||
if (Log.showSrcInSources) {
|
||||
return logger.emit('viewJson', log.src)
|
||||
}
|
||||
let $json = $el.find('.eruda-json')
|
||||
if ($json.hasClass('eruda-hidden')) {
|
||||
if ($json.data('init') !== 'true') {
|
||||
@@ -189,7 +191,7 @@ export default class Log {
|
||||
}
|
||||
} else if (log.args) {
|
||||
log.extractObj(function() {
|
||||
Log.click(type, log, $el)
|
||||
Log.click(type, log, $el, logger)
|
||||
delete log.args
|
||||
})
|
||||
}
|
||||
|
||||
@@ -311,13 +311,7 @@ export default class Logger extends Emitter {
|
||||
}
|
||||
if (!log) return
|
||||
|
||||
let action = Log.click(type, log, $el)
|
||||
|
||||
switch (action) {
|
||||
case 'viewSrc':
|
||||
self.emit('viewJson', log.src)
|
||||
break
|
||||
}
|
||||
Log.click(type, log, $el, self)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user