Socket
Socket
Sign inDemoInstall

ampersand-pagination-mixin

Package Overview
Dependencies
11
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ampersand-pagination-mixin

A simple mixin to be used with ampersand-rest-collection, to perform paginated requests


Version published
Weekly downloads
2
Maintainers
1
Install size
70.3 kB
Created
Weekly downloads
 

Readme

Source

js-semistandard-style Dependency Status devDependency Status

ampersand-pagination-mixin

A simple mixin to be used with ampersand collection to perform paginated requests. This module assumes you somehow implement a restful method collection.fetch() therefore being a perfect match to be used with ampersand-rest-collection. It works by inserting a skip and limit fields on the query component of the URI.

Example:

  var InfiniteScrollMixin = require('ampersand-pagination-mixin');
  var RestCollection = require('ampersand-rest-collection');
  var MyModel = require('./MyModel');

  var PaginatedCollection = RestCollection.extend(InfiniteScrollMixin, {
    model: MyModel,
    url: '/api/paginated-resource'
  });
  
  var myCollection = new PaginatedCollection();

  // Now just use the method and let it keep the state for you
  myCollection.fetchPage();

To use this collection with a infinite scroll view use ampersand-infinite-scroll as it works out of the box with it.

credits

Created by @JGAntunes, with the support of @SINFO.

license

MIT

Keywords

FAQs

Last updated on 07 Jul 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc