How to use ember-data-storefront - 5 common examples

To help you get started, we’ve selected a few ember-data-storefront 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 embermap / ember-data-storefront / addon / -private / queries / array.js View on Github external
isFresh() {
    let expires = this.params.expires;
    let lastRun = this.lastRun;

    return this.value &&
      lastRun &&
      expires &&
      expires !== "immediately" &&
      (expires === "never" || ago(expires).isBefore(lastRun));
  }
github embermap / ember-data-storefront / addon / -private / coordinators / record-arrays.js View on Github external
constructor(strategyClass) {
    this.strategyClass = strategyClass;
    this.cache = new Cache();
  }
github embermap / ember-data-storefront / addon / mixins / loadable-store.js View on Github external
resetCache() {
    this.coordinator = new Coordinator(this);
  }
github embermap / ember-data-storefront / addon / -private / coordinators / record-arrays.js View on Github external
query(store, type, params) {
    let query = this.cache.getRecordArrayQuery(type, params);

    if (!query) {
      let strategy = new this.strategyClass();
      query = new ArrayQuery(store, type, params, strategy);
      this.cache.putRecordArrayQuery(query);
    }

    return query;
  }
}
github embermap / ember-data-storefront / addon / mixins / fastboot-adapter.js View on Github external
_getStorefrontBoxedQuery(type, url, params) {
    let payload;
    let fastboot = this.get('fastboot');
    let isFastboot = fastboot && fastboot.get('isFastBoot');
    let shoebox = fastboot && fastboot.get('shoebox');
    let box = shoebox && shoebox.retrieve('ember-data-storefront');

    if (!isFastboot && box && box.queries && Object.keys(box.queries).length > 0) {
      let key = shoeboxize(cacheKey([type, url.replace(/^.*\/\/[^\/]+/, ''), params]));
      payload = box.queries[key];
      delete box.queries[key];
    }

    return payload;
  }