Skip to content

Commit 4d95e52

Browse files
committed
release(logcat): v0.6.1
1 parent 4dfaaf6 commit 4d95e52

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

index.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"logcat": {
184184
"react": true,
185185
"dependencies": ["virtual-list"],
186-
"version": "0.6.0",
186+
"version": "0.6.1",
187187
"style": true,
188188
"icon": false,
189189
"test": true,

src/logcat/index.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Component, { IComponentOptions } from '../share/Component'
22
import escape from 'licia/escape'
33
import h from 'licia/h'
4-
import types from 'licia/types'
54
import throttle from 'licia/throttle'
65
import trim from 'licia/trim'
76
import isDate from 'licia/isDate'
@@ -76,7 +75,6 @@ interface IInnerEntry extends IBaseEntry {
7675
* })
7776
*/
7877
export default class Logcat extends Component<IOptions> {
79-
private render: types.AnyFn
8078
private entries: Array<IInnerEntry> = []
8179
private displayEntries: Array<IInnerEntry> = []
8280
private removeThreshold = 1
@@ -106,7 +104,6 @@ export default class Logcat extends Component<IOptions> {
106104
this.removeThreshold = Math.round(maxNum / 10)
107105
}
108106

109-
this.render = throttle(() => this._render(), 16)
110107
if (this.options.entries) {
111108
each(this.options.entries, (entry) => {
112109
this.append(entry)
@@ -240,6 +237,7 @@ export default class Logcat extends Component<IOptions> {
240237
} else {
241238
this.$container.rmClass(c('wrap-long-lines'))
242239
}
240+
this.virtualList.update()
243241
break
244242
case 'maxNum':
245243
if (val > 0 && entries.length > val) {
@@ -256,6 +254,7 @@ export default class Logcat extends Component<IOptions> {
256254

257255
entry.container.innerHTML = html
258256
})
257+
this.virtualList.update()
259258
break
260259
case 'filter':
261260
this.displayEntries = []
@@ -317,18 +316,15 @@ export default class Logcat extends Component<IOptions> {
317316
`<span class="${c('message')}">${escape(trim(entry.message))}</span>`,
318317
].join(' ')
319318
}
320-
private _render() {
321-
const { container } = this
322-
this.$container.html('')
323-
324-
const frag = document.createDocumentFragment()
319+
private render = throttle(() => {
320+
const items: HTMLElement[] = []
325321
each(this.displayEntries, (entry) => {
326-
frag.appendChild(entry.container)
322+
items.push(entry.container)
327323
})
328-
container.appendChild(frag)
324+
this.virtualList.setItems(items)
329325

330326
this.scrollToEnd()
331-
}
327+
}, 16)
332328
}
333329

334330
function toLetter(priority: number) {

src/logcat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logcat",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "Android logcat viewer",
55
"luna": {
66
"react": true,

0 commit comments

Comments
 (0)