Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. // possible baselayers
  2. App.BaseLayer = Ember.Model.extend({
  3. // has various props
  4. });
  5.  
  6. //config
  7. App.Config = Ember.Model.extend({
  8. appName: attr(),
  9. appId: attr(),
  10. login: attr(),
  11. baseLayers: Ember.hasMany('App.BaseLayer', {key: 'baseLayerItems', embedded: true}),
  12. //...and so on
  13. });
  14.  
  15. //create config instance
  16. App.initializer({
  17. name: 'preload',
  18.  
  19. initialize: function(container) {
  20. // defer and advance readiness used to allow app
  21. // to grab config before loading rest of app
  22. App.deferReadiness();
  23.  
  24. App.ConfigStore.getConfigJSON().then(
  25. function(json) {
  26.  
  27. var config = App.Config.create({container: container});
  28. container.register('app:config', config, {instantiate: false});
  29. config.load(1, json);
  30. // we actually inject this config in various spots, but that's not relevant here...
  31. App.appConfig = config;
  32.  
  33. },
  34. function(status, request, error) {
  35. window.location.replace("initialize_error.html");
  36. }
  37. );
  38. }
  39. });
  40.  
  41. App.BaseLayer.forEachCachedRecord(
  42. function(r) {console.log(r.get('id'));
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement