Created
January 6, 2014 21:26
-
-
Save consideRatio/8290103 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONSOLE_LOG: | |
1 | |
2 | |
RETURNING | |
3 | |
4 | |
PROBLEM & Question: | |
Ember does not render anything until passing point 4, that takes considerable time, can i get it to render without waiting? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SpeedMind.SourceRoute = Ember.Route.extend({ | |
model: function (params) { | |
var id = params.source_id; | |
var store = this.get('store'); | |
var scope = this; | |
var source = store.getById('source', id); | |
if (source) | |
return source; | |
var promise = new Ember.RSVP.Promise(function(resolve, reject){ | |
console.log(1); | |
var something = SpeedMind.getDoc(id).then(function(response) { | |
console.log(3); | |
store.pushPayload(response); | |
console.log(4); | |
source = store.getById('source', id); | |
return source | |
}); | |
console.log(2); | |
resolve(something); | |
}); | |
console.log("RETURNING"); | |
return promise; | |
}, | |
renderTemplate: function() { | |
this.render(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment