blob: a01809cdcb7d12b7125c436fa81cb68f4606d0bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
var ScrollableView = View.extend({
events: {
"load img": "deferRefresh",
},
deferScrollToTop: function(){
if (! this.scroller) return
setTimeout(this.scrollToTop.bind(this), 0)
},
refreshScroller: function(){
if (! this.scroller) return
this.scroller.refresh()
clearTimeout( this.scrollerRefreshTimeout )
},
scrollerRefreshTimeout: null,
deferRefresh: function(){
if (! this.scroller) return
clearTimeout( this.scrollerRefreshTimeout )
this.scrollerRefreshTimeout = setTimeout(this.refreshScroller.bind(this))
},
scrollToTop: function(){
if (! this.scroller) return
this.scroller.refresh()
app.collection.scroller.scrollTo(0, 0)
},
})
|