pulltorefreshjs - Added missing function exports and properties to Options interface

This commit is contained in:
humpedli
2018-02-13 16:21:02 +01:00
parent 242fcd3080
commit e835f5bb28
2 changed files with 25 additions and 0 deletions
+19
View File
@@ -1,10 +1,15 @@
// Type definitions for pulltorefreshjs 0.1
// Project: https://github.com/BoxFactura/pulltorefresh.js
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Tamas Kinsztler <https://github.com/humpedli>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function init(options?: Options): void;
export function destroyAll(): void;
export function setPassiveMode(isPassive: boolean): void;
export interface Options {
/**
* Minimum distance required to trigger the refresh.
@@ -108,6 +113,20 @@ export interface Options {
* Defaults to `t => Math.min(1, t / 2.5)`
*/
resistanceFunction?(input: number): number;
/**
* Which condition should be met for pullToRefresh to trigger?
*
* Defaults to `!window.scrollY`
*/
shouldPullToRefresh?(): boolean;
/**
* This value will be passed as `{ passive: true|false }` to `touchmove`
* listeners if passive-handlers are supported.
* (default: `false`)
*/
passive?: boolean;
}
/**
@@ -17,3 +17,9 @@ PullToRefresh.init({
mainElement: "body",
onRefresh: () => Promise.resolve(),
});
PullToRefresh.destroyAll();
PullToRefresh.setPassiveMode(true);
PullToRefresh.setPassiveMode(false);