0.0.5 • Published 7 years ago

p-t-r v0.0.5

Weekly downloads
4
License
CC0-1.0
Repository
github
Last release
7 years ago

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.

View the demo.

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()