UNPKG

5.6 kBTypeScriptView Raw
1import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
2import { RefresherEventDetail } from '../../interface';
3export declare class Refresher implements ComponentInterface {
4 private appliedStyles;
5 private didStart;
6 private progress;
7 private scrollEl?;
8 private backgroundContentEl?;
9 private scrollListenerCallback?;
10 private gesture?;
11 private pointerDown;
12 private needsCompletion;
13 private didRefresh;
14 private lastVelocityY;
15 private elementToTransform?;
16 private animations;
17 private nativeRefresher;
18 el: HTMLIonRefresherElement;
19 /**
20 * The current state which the refresher is in. The refresher's states include:
21 *
22 * - `inactive` - The refresher is not being pulled down or refreshing and is currently hidden.
23 * - `pulling` - The user is actively pulling down the refresher, but has not reached the point yet that if the user lets go, it'll refresh.
24 * - `cancelling` - The user pulled down the refresher and let go, but did not pull down far enough to kick off the `refreshing` state. After letting go, the refresher is in the `cancelling` state while it is closing, and will go back to the `inactive` state once closed.
25 * - `ready` - The user has pulled down the refresher far enough that if they let go, it'll begin the `refreshing` state.
26 * - `refreshing` - The refresher is actively waiting on the async operation to end. Once the refresh handler calls `complete()` it will begin the `completing` state.
27 * - `completing` - The `refreshing` state has finished and the refresher is in the way of closing itself. Once closed, the refresher will go back to the `inactive` state.
28 */
29 private state;
30 /**
31 * The minimum distance the user must pull down until the
32 * refresher will go into the `refreshing` state.
33 * Does not apply when the refresher content uses a spinner,
34 * enabling the native refresher.
35 */
36 pullMin: number;
37 /**
38 * The maximum distance of the pull until the refresher
39 * will automatically go into the `refreshing` state.
40 * Defaults to the result of `pullMin + 60`.
41 * Does not apply when the refresher content uses a spinner,
42 * enabling the native refresher.
43 */
44 pullMax: number;
45 /**
46 * Time it takes to close the refresher.
47 * Does not apply when the refresher content uses a spinner,
48 * enabling the native refresher.
49 */
50 closeDuration: string;
51 /**
52 * Time it takes the refresher to to snap back to the `refreshing` state.
53 * Does not apply when the refresher content uses a spinner,
54 * enabling the native refresher.
55 */
56 snapbackDuration: string;
57 /**
58 * How much to multiply the pull speed by. To slow the pull animation down,
59 * pass a number less than `1`. To speed up the pull, pass a number greater
60 * than `1`. The default value is `1` which is equal to the speed of the cursor.
61 * If a negative value is passed in, the factor will be `1` instead.
62 *
63 * For example: If the value passed is `1.2` and the content is dragged by
64 * `10` pixels, instead of `10` pixels the content will be pulled by `12` pixels
65 * (an increase of 20 percent). If the value passed is `0.8`, the dragged amount
66 * will be `8` pixels, less than the amount the cursor has moved.
67 *
68 * Does not apply when the refresher content uses a spinner,
69 * enabling the native refresher.
70 */
71 pullFactor: number;
72 /**
73 * If `true`, the refresher will be hidden.
74 */
75 disabled: boolean;
76 disabledChanged(): void;
77 /**
78 * Emitted when the user lets go of the content and has pulled down
79 * further than the `pullMin` or pulls the content down and exceeds the pullMax.
80 * Updates the refresher state to `refreshing`. The `complete()` method should be
81 * called when the async operation has completed.
82 */
83 ionRefresh: EventEmitter<RefresherEventDetail>;
84 /**
85 * Emitted while the user is pulling down the content and exposing the refresher.
86 */
87 ionPull: EventEmitter<void>;
88 /**
89 * Emitted when the user begins to start pulling down.
90 */
91 ionStart: EventEmitter<void>;
92 private checkNativeRefresher;
93 private destroyNativeRefresher;
94 private resetNativeRefresher;
95 private setupiOSNativeRefresher;
96 private setupMDNativeRefresher;
97 private setupNativeRefresher;
98 componentDidUpdate(): void;
99 connectedCallback(): Promise<void>;
100 disconnectedCallback(): void;
101 /**
102 * Call `complete()` when your async operation has completed.
103 * For example, the `refreshing` state is while the app is performing
104 * an asynchronous operation, such as receiving more data from an
105 * AJAX request. Once the data has been received, you then call this
106 * method to signify that the refreshing has completed and to close
107 * the refresher. This method also changes the refresher's state from
108 * `refreshing` to `completing`.
109 */
110 complete(): Promise<void>;
111 /**
112 * Changes the refresher's state from `refreshing` to `cancelling`.
113 */
114 cancel(): Promise<void>;
115 /**
116 * A number representing how far down the user has pulled.
117 * The number `0` represents the user hasn't pulled down at all. The
118 * number `1`, and anything greater than `1`, represents that the user
119 * has pulled far enough down that when they let go then the refresh will
120 * happen. If they let go and the number is less than `1`, then the
121 * refresh will not happen, and the content will return to it's original
122 * position.
123 */
124 getProgress(): Promise<number>;
125 private canStart;
126 private onStart;
127 private onMove;
128 private onEnd;
129 private beginRefresh;
130 private close;
131 private setCss;
132 render(): any;
133}