Usage
Typescript Import Format
//This namespace exports multiple static methods or members. To import
import * as PullToRefreshUtils from "ojs/ojpulltorefresh";
//Now you can access the methods as PullToRefreshUtils.methodName and so on
For additional information visit:
Methods
-
(static) setupPullToRefresh(element, refreshFunc, options) : {void}
-
Setup content container for pull to refresh capability. This method adds touch listeners on the content container. The following events are fired by this method: ojpull is fired when user pulls the content container, the event contains the content element as well as the distance pulled in pixels. ojrelease is fired when user releases the content container, the event contains the content element. ojcomplete is fired when the refresh is done and the panel is completely closed. The event contains the content element.
Parameters:
Name Type Argument Description element
Element the DOM element that hosts the content to refresh. When the content is scrollable, the value of this parameter must be the scrollable element. Specifically, when using this with ListView, the ListView element might not necessarily be the scrollable element, but is one of its ancestors instead. refreshFunc
function():Promise.<any> the function to invoke when refresh is triggered. It must return a Promise. options
Object <optional>
optional values that controls aspects of pull to refresh Properties
Name Type Argument Description threshold
number <optional>
the number of pixels to pull until refresh is triggered. If not specified, a default value will be calculated based on the height of the panel consisting the refresh icon, primary text, and secondary text. primaryText
string <optional>
the primary text to display. The primary text is usually used to describe the pull action. If not specified then no primary text will be displayed. secondaryText
string <optional>
the secondary text to display. The secondary text is used to add supplementary text. If not specified then no secondary text will be displayed. refresherElement
Element <optional>
the refresher component that the PullToRefreshUtils are hooked into. If specified, the busyState will be attached to the refresher element. Otherwise, will use the scroller elmeent instead. Returns:
- Type
- void
-
(static) tearDownPullToRefresh(element) : {void}
-
Removes the listener that was added in setupPullToRefresh. Page authors should call tearDownPullToRefresh when the content container is no longer needed.
Parameters:
Name Type Description element
Element the DOM element that hosts the content to refresh - See:
Returns:
- Type
- void