mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't update unless view is on the DOM
This commit is contained in:
@@ -21,6 +21,7 @@ class EditorStatsView extends ScrollView
|
||||
super
|
||||
|
||||
resizer = =>
|
||||
return unless @isOnDom()
|
||||
@draw()
|
||||
@update()
|
||||
@subscribe $(window), 'resize', _.debounce(resizer, 300)
|
||||
@@ -71,9 +72,10 @@ class EditorStatsView extends ScrollView
|
||||
.attr('width', @x.rangeBand())
|
||||
.attr('class', 'bar')
|
||||
|
||||
setTimeout((=> @update()), 100)
|
||||
clearInterval(@updateInterval)
|
||||
@updateInterval = setInterval((=> @update()), 5000)
|
||||
updater = => @update() if @isOnDom()
|
||||
setTimeout(updater, 100)
|
||||
@updateInterval = setInterval(updater, 5000)
|
||||
|
||||
update: ->
|
||||
newData = d3.entries @stats.eventLog
|
||||
|
||||
Reference in New Issue
Block a user