mirror of
https://github.com/liriliri/eruda.git
synced 2026-02-02 09:49:00 +08:00
perf(console): reduce memory, 30% drop
This commit is contained in:
@@ -144,7 +144,7 @@ export default class Log {
|
||||
return this.el.outerHTML
|
||||
}
|
||||
text() {
|
||||
return this.el.textContent
|
||||
return this._content.textContent
|
||||
}
|
||||
_needSrc() {
|
||||
const { type, args } = this
|
||||
@@ -287,7 +287,6 @@ export default class Log {
|
||||
}
|
||||
|
||||
if (type !== 'error') msg = recognizeUrl(msg)
|
||||
this.value = msg
|
||||
msg = render({ msg, type, icon, id, displayHeader, time, from, group })
|
||||
|
||||
if (!this._needSrc() || !Log.lazyEvaluation) {
|
||||
@@ -295,6 +294,8 @@ export default class Log {
|
||||
}
|
||||
|
||||
this._$el.addClass('eruda-log-container').html(msg)
|
||||
this._$content = this._$el.find('.eruda-log-content')
|
||||
this._content = this._$content.get(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -342,9 +342,9 @@ export default class Logger extends Emitter {
|
||||
if (
|
||||
!contain(['html', 'group', 'groupCollapsed'], log.type) &&
|
||||
lastLog.type === log.type &&
|
||||
lastLog.value === log.value &&
|
||||
!log.src &&
|
||||
!log.args
|
||||
!log.args &&
|
||||
lastLog.text() === log.text()
|
||||
) {
|
||||
lastLog.addCount()
|
||||
if (log.time) lastLog.updateTime(log.time)
|
||||
|
||||
Reference in New Issue
Block a user