drf-paginator v0.3.0
drf-paginator
JavaScript module for consuming paginated Django REST framework endpoints.
Usage
The paginator separates pagination logic from each individual request to the endpoint.
import drfp from 'drf-paginator';Each request to the endpoint is handled by a request function. Request functions are provided with options and query parameters to make requests. They in turn return promises for the response body.
let request = function(options, queryParams) {
return Promise<ResponseBody>;
}Each paginator is provided with a request function to send requests.
let paginator = drfp.paginate(request);Paginator's provide an interface for pagination while caching requests.
paginator.next()
.then((responseBody) => {
// Do something with the response
});Please view the API reference for details and more examples.
Requirements
A Promises/A+ compliant promise implementation must be available globally.
Consuming packages using Browserify must have the Babelify transform, and the ES2015 preset available.
Installation
Node.js via npm
$ npm install --save drf-paginatorSystemJS via jspm
$ jspm install npm:drf-paginatorScripts
Install dependencies
$ npm installRun the test suite, generate coverage reports, and lint the source
$ npm testRun linter
$ npm run jshintRun unit tests
$ npm run unitRun the test suite, and generate coverage reports
$ npm run coverPublish coverage report
$ npm run coverallsLicense
Copyright © 2016 Yola. Released under the MIT Expat License.