lib/autoPagination.js
function memoizedPromise(promiseCache, cb) {
  if (promiseCache.currentPromise) {
    return promiseCache.currentPromise;
  }
  promiseCache.currentPromise = new Promise(cb).then(function(ret) {
    promiseCache.currentPromise = undefined;
    return ret;
  });
  return promiseCache.currentPromise;
}
function memoizedPromise(promiseCache, cb) {
  if (promiseCache.currentPromise) {
    return promiseCache.currentPromise;
  }
  promiseCache.currentPromise = new Promise(cb).then(function(ret) {
    promiseCache.currentPromise = undefined;
    return ret;
  });
  return promiseCache.currentPromise;
}
function memoizedPromise ( promiseCache , cb ) { if ( promiseCache . currentPromise ) { return promiseCache . currentPromise ; } promiseCache . currentPromise = new Promise ( cb ) . then ( function ( ret ) { promiseCache . currentPromise = undefined ; return ret ; } ) ; return promiseCache . currentPromise ; }
If a user calls `.next()` multiple times in parallel,
return the same result until something has resolved
to prevent page-turning race conditions.
If a user calls . next () multiple times in parallel return the same result until something has resolved to prevent page - turning race conditions .