feat(queue): use stencil's queue controller for dom read/writes

This commit is contained in:
Adam Bradley
2018-04-11 15:24:49 -05:00
parent 6a31f3960a
commit d623b3b71f
17 changed files with 75 additions and 145 deletions

View File

@ -1,5 +1,5 @@
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
import { Config, DomController, GestureDetail } from '../../index';
import { Config, GestureDetail, QueueController } from '../../index';
@Component({
tag: 'ion-scroll',
@ -22,7 +22,7 @@ export class Scroll {
@Element() private el: HTMLElement;
@Prop({ context: 'config'}) config: Config;
@Prop({ context: 'dom' }) dom: DomController;
@Prop({ context: 'queue' }) queue: QueueController;
@Prop() mode: string;
@ -99,7 +99,7 @@ export class Scroll {
}
if (!this.queued && this.scrollEvents) {
this.queued = true;
this.dom.read(timeStamp => {
this.queue.read(timeStamp => {
this.queued = false;
this.detail.event = ev;
updateScrollDetail(this.detail, this.el, timeStamp, didStart);
@ -189,7 +189,7 @@ export class Scroll {
if (easedT < 1) {
// do not use DomController here
// must use nativeRaf in order to fire in the next frame
self.dom.raf(step);
self.queue.read(step);
} else {
stopScroll = true;
@ -203,8 +203,8 @@ export class Scroll {
self.isScrolling = true;
// chill out for a frame first
this.dom.write(() => {
this.dom.write(timeStamp => {
this.queue.write(() => {
this.queue.write(timeStamp => {
startTime = timeStamp;
step(timeStamp);
});