UNPKG

2.54 kBTypeScriptView Raw
1import { App } from '../components/app/app';
2import { DomCallback, DomController } from '../platform/dom-controller';
3import { Platform } from '../platform/platform';
4export declare class ScrollView {
5 private _app;
6 private _plt;
7 private _dom;
8 ev: ScrollEvent;
9 isScrolling: boolean;
10 onScrollStart: (ev: ScrollEvent) => void;
11 onScroll: (ev: ScrollEvent) => void;
12 onScrollEnd: (ev: ScrollEvent) => void;
13 initialized: boolean;
14 _el: HTMLElement;
15 private _eventsEnabled;
16 private _js;
17 private _t;
18 private _l;
19 private _lsn;
20 private _endTmr;
21 constructor(_app: App, _plt: Platform, _dom: DomController);
22 init(ele: HTMLElement, contentTop: number, contentBottom: number): void;
23 enableEvents(): void;
24 setScrolling(isScrolling: boolean, ev: ScrollEvent): void;
25 private enableNativeScrolling();
26 /**
27 * @hidden
28 * JS Scrolling has been provided only as a temporary solution
29 * until iOS apps can take advantage of scroll events at all times.
30 * The goal is to eventually remove JS scrolling entirely. When we
31 * no longer have to worry about iOS not firing scroll events during
32 * inertia then this can be burned to the ground. iOS's more modern
33 * WKWebView does not have this issue, only UIWebView does.
34 */
35 enableJsScroll(contentTop: number, contentBottom: number): void;
36 /**
37 * DOM READ
38 */
39 getTop(): number;
40 /**
41 * DOM READ
42 */
43 getLeft(): number;
44 /**
45 * DOM WRITE
46 */
47 setTop(top: number): void;
48 /**
49 * DOM WRITE
50 */
51 setLeft(left: number): void;
52 scrollTo(x: number, y: number, duration: number, done?: Function): Promise<any>;
53 scrollToTop(duration: number): Promise<any>;
54 scrollToBottom(duration: number): Promise<any>;
55 stop(): void;
56 /**
57 * @hidden
58 */
59 destroy(): void;
60}
61export interface ScrollEvent {
62 timeStamp: number;
63 scrollTop: number;
64 scrollLeft: number;
65 scrollHeight: number;
66 scrollWidth: number;
67 contentHeight: number;
68 contentWidth: number;
69 contentTop: number;
70 contentBottom: number;
71 startY: number;
72 startX: number;
73 deltaY: number;
74 deltaX: number;
75 velocityY: number;
76 velocityX: number;
77 directionY: string;
78 directionX: string;
79 domWrite: {
80 (fn: DomCallback, ctx?: any): void;
81 };
82 contentElement?: HTMLElement;
83 fixedElement?: HTMLElement;
84 scrollElement?: HTMLElement;
85 headerElement?: HTMLElement;
86 footerElement?: HTMLElement;
87}