fix(scroll): fix JS error when scrolling text input

This commit is contained in:
Adam Bradley
2015-11-16 16:35:59 -06:00
parent df3a59dc81
commit 3ec39c51b5
4 changed files with 110 additions and 84 deletions

View File

@ -6,7 +6,6 @@ import {Keyboard} from '../../util/keyboard';
import {ViewController} from '../nav/view-controller';
import {Animation} from '../../animations/animation';
import {ScrollTo} from '../../animations/scroll-to';
import {FeatureDetect} from '../../util/feature-detect';
/**
* The Content component provides an easy to use content area that can be configured to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.
@ -72,14 +71,16 @@ export class Content extends Ion {
}
}
onScrollEnd(callback) {
onScrollEnd(callback, debounceWait=400) {
let timerId, deregister;
function debounce() {
console.debug('onScroll')
clearTimeout(timerId);
timerId = setTimeout(() => {
deregister();
callback();
}, 250);
}, debounceWait);
}
deregister = this.addScrollEventListener(debounce);