0.1.2 • Published 7 years ago

pulljs v0.1.2

Weekly downloads
14
License
ISC
Repository
github
Last release
7 years ago

pulljs

this is a pure javascript library to provide a lightweight and awesome pull to load

Install & Use

npm save --save pulljs

how to use

import Pull from 'pulljs';

Pull.init({
  // mainElement: '',
  instructionsPullToRefresh: 'Pull to Refresh',
  instructionsReleaseToRefresh: 'Release to Refresh',
  instructionsRefreshing: 'Refreshing',
  onRefresh: () => alert('hello pulljs')
});

Options

Pull.init({
  distThreshold: 60,
  distMax: 80,
  distReload: 50,
  mainElement: 'body',
  triggerElement: 'body',
  instructionsPullToRefresh: 'Pull down to refresh',
  instructionsReleaseToRefresh: 'Release to refresh',
  instructionsRefreshing: 'Refreshing',
  refreshTimeout: 500,
  onRefresh: () => location.reload(),
  resistanceFunction: t => Math.min(1, t / 2.5),
});
optionsintroducedefault value
distThresholdminimum trigger the refresh60
distMaxmaximum distance for the component80
distReloadafter the distThreshold is reached and released, the component will have this height50
mainElementbefore which dom component the pull to refresh elements will bebody(css selector)
triggerElementwhich element should trigger the pull to refresh?body(css selector)
instructionsPullToRefreshthe initial instructions stringPull down to refresh
instructionsReleaseToRefreshthe instructions string when the distThreshold has been reachedRelease to refresh
instructionsRefreshingthe refreshing text(can be dom component string)Refreshing
refreshTimeoutthe delay, in milliseconds before the onRefresh is triggered500
onRefreshwhat will the pull to refresh trigger? you can return a promise. Defaults to window.location.reload()null
resistanceFunctionthe resistance function, accepts one parameter, must return a number, capping at 1. Defaults to t => Math.min(1, t / 2.5)null