How to use the ember-infinity/lib/infinity-promise-array.create function in ember-infinity

To help you get started, we’ve selected a few ember-infinity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-infinity / ember-infinity / addon / services / infinity.js View on Github external
if (cachedModel) {
        // 2. If cachedModel, get future_timestamp (ms since 1970) and compare to now
        let future_timestamp = Object.keys(cachedModel)[0];
        if (future_timestamp > Date.now()) {
          return cachedModel[future_timestamp];
        } else {
          // 3. cache collection based on new timestamp
          cacheInfinityCollection(_cachedCollection, infinityModel, uniqueIdentifier, infinityCache);
        }
      } else {
        // 2. if we are expired (future_timestamp < Date.now()) or cachedModel doesn't exist, cache a new infinityModel + future timestamp
        cacheInfinityCollection(_cachedCollection, infinityModel, uniqueIdentifier, infinityCache);
      }
    }

    return InfinityPromiseArray.create({ promise: this['loadNextPage'](infinityModel) });
  }
github ember-infinity / ember-infinity / addon / mixins / route.js View on Github external
if (didPassBoundParams) {
      initParams._deprecatedBoundParams = boundParams;
      initParams.route = this;
    }
    if (infinityModelLoaded) {
      initParams.infinityModelLoaded = infinityModelLoaded;
    }
    if (afterInfinityModel) {
      initParams.afterInfinityModel = afterInfinityModel;
    }

    const infinityModel = InfinityModelFactory.create(initParams);
    get(this, 'infinity._ensureCompatibility')(get(infinityModel, 'store'), get(infinityModel, 'storeFindMethod'));
    get(this, 'infinity.infinityModels').pushObject(infinityModel);

    return InfinityPromiseArray.create({ promise: service['loadNextPage'](infinityModel) });
  },

ember-infinity

Simple, flexible infinite scroll for Ember CLI Apps.

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis