1.4.0 • Published 8 years ago

everscroll v1.4.0

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

Everscroll

npm version

Really simple infinite scroll library

Thanks to: https://github.com/alexblack/infinite-scroll

  • No dependencies
  • Tested in Chrome 17, IE7, Firefox 11, Android 2.3 Browser, iPad 2 with IOS5
  • Handles touch events to respond before the end of the user's scroll on devices like the iPad

Usage (vanilla with callback)

// setup
var infiniteScroll = require('everscroll')({
  distance: 50
});

// initiate
infiniteScroll(function(done) {
  // 1. fetch data from the server
  // 2. insert it into the document
  // 3. call done when we are done
  done();
});

Usage (redux - without callback)

// setup
var infiniteScroll = require('everscroll')({
  distance: 50,
  disableCallback: true
});

// redux store
var store = configureStore({
  isLoadingNewData: false
});

// initiate
infiniteScroll(function() {
  if (store.getState().isLoadingNewData) {
    return;
  }

  // Dispatch an action creator to do data fetching and trigger a re-render
  // (NOTE: this action creator sequence should also set state.isLoadingNewData appropriately)
  store.dispatch(populateNextPage());
});
1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago