How to use the ember-data.Store function in ember-data

To help you get started, we’ve selected a few ember-data 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 firebase / emberfire / addon / initializers / emberfire.js View on Github external
application.register('adapter:-firebase', FirebaseAdapter);
    application.register('serializer:-firebase', FirebaseSerializer);

    const providerSettings = {instantiate: false, singleton: false};
    application.register('firebase-auth-provider:twitter',
        firebase.auth.TwitterAuthProvider, providerSettings);
    application.register('firebase-auth-provider:facebook',
        firebase.auth.FacebookAuthProvider, providerSettings);
    application.register('firebase-auth-provider:github',
        firebase.auth.GithubAuthProvider, providerSettings);
    application.register('firebase-auth-provider:google',
        firebase.auth.GoogleAuthProvider, providerSettings);

    // Monkeypatch the store until ED gives us a good way to listen to push events
    if (!DS.Store.prototype._emberfirePatched) {
      DS.Store.reopen({
        _emberfirePatched: true,

        _emberfireHandleRecordPush(records) {
          if (typeof records !== 'undefined') {
            records.forEach((record) => {
              var modelName = record.constructor.modelName;
              var adapter = this.adapterFor(modelName);
              if (adapter.recordWasPushed) {
                adapter.recordWasPushed(this, modelName, record);
              }
            });
          }
        },

        push() {
github sir-dunxalot / ember-blog / addon / stores / application.js View on Github external
import DS from 'ember-data';

export default DS.Store.extend({
  // adapter: 'application' // TODO
});
github alphasights / ember-graphql-adapter / tests / helpers / store.js View on Github external
}
  };

  var adapter = env.adapter = (options.adapter || '-default');
  delete options.adapter;

  if (typeof adapter !== 'string') {
    env.registry.register('adapter:-ember-data-test-custom', adapter);
    adapter = '-ember-data-test-custom';
  }

  for (var prop in options) {
    registry.register('model:' + dasherize(prop), options[prop]);
  }

  registry.register('service:store', DS.Store.extend({
    adapter: adapter
  }));

  registry.optionsForType('serializer', { singleton: false });
  registry.optionsForType('adapter', { singleton: false });
  registry.register('adapter:-default', DS.Adapter);

  registry.register('serializer:-default', DS.JSONSerializer);
  registry.register('serializer:-rest', DS.RESTSerializer);

  registry.register('adapter:-rest', DS.RESTAdapter);

  registry.register('adapter:-json-api', DS.JSONAPIAdapter);
  registry.register('serializer:-json-api', DS.JSONAPISerializer);

  registry.register('adapter:-graphql', Adapter);
github uhuraapp / uhura-frontend / app / initializers / online-store.js View on Github external
import DS from 'ember-data';
import ENV from '../config/environment';

var restAdapter = DS.RESTAdapter.extend({
  namespace: 'v2',
  host: ENV.API_URL,
  pathForType: function(type){
    return (this.__isUserPath(type) ? "users/" : "") + (type === "parser" ? "parser" : this._super(type));
  },
  __isUserPath: function(type) {
    return ['subscription', 'suggestion'].indexOf(type) > -1;
  }
});

var OnlineStore = DS.Store.extend({
  adapterFor: function() {
    return this.container.lookup('adapter:_online_adapter');
  }
});

export function initialize(container, application) {
  container.register('store:online', OnlineStore);
  container.register('adapter:_online_adapter', restAdapter);

  application.inject('route',      'onlineStore', 'store:online');
  application.inject('controller', 'onlineStore', 'store:online');
}

export default {
  name: 'online-store',
  initialize: initialize
github danielspaniel / ember-data-factory-guy / addon / factory-guy.js View on Github external
setStore(aStore) {
    assert(
      `[ember-data-factory-guy] FactoryGuy#setStore needs a valid store instance. You passed in [${aStore}]`,
      aStore instanceof DS.Store
    );
    this.store = aStore;
    this.fixtureBuilderFactory = new FixtureBuilderFactory(this.store);
    this.afterDestroyStore(aStore);
  }
github adiwg / mdEditor / app / initializers / local-storage-export.js View on Github external
export function initialize() {
  DS.Store.reopen({
    exportSelectedData(types, options) {
      return exportSelected(this, types, options);
    }
  });
}
github funkensturm / ember-local-storage / addon / initializers / local-storage-adapter.js View on Github external
export function initialize() {
  if (!DS.Store.prototype._emberLocalStoragePatched) {
    DS.Store.reopen({
      _emberLocalStoragePatched: true,
      importData: function(json, options) {
        return importData(this, json, options);
      },
      exportData: function(types, options) {
        return exportData(this, types, options);
      }
    });
  }
}
github funkensturm / ember-local-storage / addon / initializers / local-storage-adapter.js View on Github external
export function initialize() {
  if (!DS.Store.prototype._emberLocalStoragePatched) {
    DS.Store.reopen({
      _emberLocalStoragePatched: true,
      importData: function(json, options) {
        return importData(this, json, options);
      },
      exportData: function(types, options) {
        return exportData(this, types, options);
      }
    });
  }
}