fix(app-root): async disable-scroll is cancelled properly

references #9367
This commit is contained in:
Manu Mtz.-Almeida
2016-11-26 19:28:57 +01:00
parent 5ff7072242
commit 177a089e91

View File

@ -113,14 +113,20 @@ export class IonicApp extends Ion implements OnInit {
* @private * @private
*/ */
_disableScroll(shouldDisableScroll: boolean) { _disableScroll(shouldDisableScroll: boolean) {
console.log('App Root: Scroll Disable Assist', shouldDisableScroll);
if (shouldDisableScroll) { if (shouldDisableScroll) {
this.stopScroll().then(() => { this.stopScroll().then(() => {
this._rafId = nativeTimeout(() => this.setElementClass('disable-scroll', true), 16 * 2); this._rafId = nativeTimeout(() => {
console.debug('App Root: adding .disable-scroll');
this.setElementClass('disable-scroll', true);
}, 16 * 2);
}); });
} else { } else {
cancelAnimationFrame(this._rafId); let plugin = this._stopScrollPlugin;
if (plugin && plugin.cancel) {
plugin.cancel();
}
clearTimeout(this._rafId);
console.debug('App Root: removing .disable-scroll');
this.setElementClass('disable-scroll', false); this.setElementClass('disable-scroll', false);
} }
} }