Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // possible baselayers
- App.BaseLayer = Ember.Model.extend({
- // has various props
- });
- //config
- App.Config = Ember.Model.extend({
- appName: attr(),
- appId: attr(),
- login: attr(),
- baseLayers: Ember.hasMany('App.BaseLayer', {key: 'baseLayerItems', embedded: true}),
- //...and so on
- });
- //create config instance
- App.initializer({
- name: 'preload',
- initialize: function(container) {
- // defer and advance readiness used to allow app
- // to grab config before loading rest of app
- App.deferReadiness();
- App.ConfigStore.getConfigJSON().then(
- function(json) {
- var config = App.Config.create({container: container});
- container.register('app:config', config, {instantiate: false});
- config.load(1, json);
- // we actually inject this config in various spots, but that's not relevant here...
- App.appConfig = config;
- },
- function(status, request, error) {
- window.location.replace("initialize_error.html");
- }
- );
- }
- });
- App.BaseLayer.forEachCachedRecord(
- function(r) {console.log(r.get('id'));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement