mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
docs(pullToRefresh): update docs
This commit is contained in:
@ -81,54 +81,154 @@ import {raf, ready, CSS} from '../../util/dom';
|
||||
directives: [NgIf, NgClass, Icon]
|
||||
})
|
||||
export class Refresher {
|
||||
private ele: HTMLElement;
|
||||
private _ele: HTMLElement;
|
||||
private _touchMoveListener;
|
||||
private _touchEndListener;
|
||||
private _handleScrollListener;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
isActive: boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
isDragging: boolean = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
isOverscrolling: boolean = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
dragOffset: number = 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
lastOverscroll: number = 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ptrThreshold: number = 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
activated: boolean = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
scrollTime: number = 500;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
canOverscroll: boolean = true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
startY;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
deltaY;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
scrollHost;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
scrollChild;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
showIcon: boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
showSpinner: boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
isRefreshing: boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
isRefreshingTail: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() pullingIcon: string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() pullingText: string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() refreshingIcon: string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() refreshingText: string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() spinner: string;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Output() pulling: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Output() refresh: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Output() starting: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
|
||||
constructor(
|
||||
@Host() private content: Content,
|
||||
element: ElementRef
|
||||
@Host() private _content: Content,
|
||||
_element: ElementRef
|
||||
) {
|
||||
this.ele = element.nativeElement;
|
||||
this.ele.classList.add('content');
|
||||
this._ele = _element.nativeElement;
|
||||
this._ele.classList.add('content');
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ngOnInit() {
|
||||
let sp = this.content.getNativeElement();
|
||||
let sc = this.content.scrollElement;
|
||||
let sp = this._content.getNativeElement();
|
||||
let sc = this._content.scrollElement;
|
||||
|
||||
this.startY = null;
|
||||
this.deltaY = null;
|
||||
@ -156,7 +256,7 @@ export class Refresher {
|
||||
* @private
|
||||
*/
|
||||
ngOnDestroy() {
|
||||
let sc = this.content.scrollElement;
|
||||
let sc = this._content.scrollElement;
|
||||
sc.removeEventListener('touchmove', this._touchMoveListener);
|
||||
sc.removeEventListener('touchend', this._touchEndListener);
|
||||
sc.removeEventListener('scroll', this._handleScrollListener);
|
||||
@ -245,7 +345,7 @@ export class Refresher {
|
||||
*/
|
||||
show() {
|
||||
// showCallback
|
||||
this.ele.classList.remove('invisible');
|
||||
this._ele.classList.remove('invisible');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,7 +353,7 @@ export class Refresher {
|
||||
*/
|
||||
hide() {
|
||||
// showCallback
|
||||
this.ele.classList.add('invisible');
|
||||
this._ele.classList.add('invisible');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,7 +361,7 @@ export class Refresher {
|
||||
*/
|
||||
tail() {
|
||||
// tailCallback
|
||||
this.ele.classList.add('refreshing-tail');
|
||||
this._ele.classList.add('refreshing-tail');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user