Skip to content

Commit 6b53a09

Browse files
committed
Misc cleanup
1 parent c3ce123 commit 6b53a09

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

plugins/editor/scroller.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ var Scroller = function() {
3636
this.jumpToBottom = true;
3737
this.dirty = false;
3838
this.console = null;
39-
this.refresh = this.renderVisible.bind(this);
40-
this.scroll = this.onScroll.bind(this);
39+
40+
//pre-bind functions and throttle expansion
41+
this.refresh = this._renderVisible.bind(this);
42+
this.scroll = this._onScroll.bind(this);
4143
this.expand = _.throttle(this._expand.bind(this), 100, {
4244
leading: true,
4345
trailing: false
4446
});
4547
};
4648

4749
Scroller.prototype.setLines = function(newLines) {
48-
// console.log(newLines);
4950
var len = newLines.length;
5051
this.lines = newLines;
5152
if(this.sticky){
@@ -73,7 +74,7 @@ Scroller.prototype.requestRefresh = function(){
7374
}
7475
};
7576

76-
Scroller.prototype.renderVisible = function(){
77+
Scroller.prototype._renderVisible = function(){
7778
this.animateRequest = null;
7879
if(this.dirty && this.console){
7980
if(this.sticky){
@@ -102,12 +103,9 @@ Scroller.prototype._expand = function(){
102103

103104
this.dirty = false;
104105
}
105-
if(!this.animateRequest){
106-
this.animateRequest = requestAnimationFrame(this.refresh);
107-
}
108106
};
109107

110-
Scroller.prototype.onScroll = function(){
108+
Scroller.prototype._onScroll = function(){
111109
var height = this.console.offsetHeight;
112110
var scrollHeight = this.console.scrollHeight;
113111
var scrollTop = this.console.scrollTop;

0 commit comments

Comments
 (0)