p-t-r
v0.0.5
Published
Pull to refresh for mobile web. Desktop support probably coming soon.
Downloads
6
Maintainers
Readme
pull-to-refresh
Trying to be, but it is not yet: Android / Chrome / Material like pull to refresh for mobile and browser that doesn't block text selection.
It works on mobile browsers. Desktop/mouse situations have a lot of annoying edge cases. There is code in this repo that deals with desktop, but it needs work to have a nice API that handles desktop considerations and yet is not ridiculous to configure for mobile also.
install
$ npm install p-t-r
example
import { pullToRefresh, Indicator, ElasticIndicator } from 'p-t-r'
import disableChromePtr from 'disable-chrome-ptr'
import bowser from 'bowser'
const enableChromePtr = (bowser.mobile && bowser.chrome) ? disableChromePtr() : () => {}
const ptr = pullToRefresh({
touchElement: document.body,
scrollElememt: document.body,
indicator: (bowser.webkit ? ElasticIndicator : Indicator)({ target: document.body }),
onRefresh: () => { return promiseFromSomeAsyncThing() }
})
// do an initial load if you want
ptr.refresh()
// to remove pull to refresh
ptr.end()
enableChromePtr()