I’m looking for some help understanding on a macroscopic level how I should be using promises in my Emberjs/EmberData app. Can anyone give me a summary of the important things to know about promises?
Specifically, I’m looking for the anwers to the following kinds of questions:
What parts of my app should be dealing with promises (i.e. calling then(), creating promises, creating promise array etc.)? Do I deal with promises just in my router? Should my controller code be dealing with promises as well? Should my model code be dealing with promises? Am I correct in saying that it’s expected for my templates to use “each” on a promise array?
How do I know what properties should be Promises/PromiseArrays or Arrays? Do I need to check through each property on every one of my models and controllers and decide whether it ever be loaded asynchronously? What about properties that are loaded asynchronously some of the time but are set with data from the client the rest of the time? Should I make sure that those properties are always promises and create trivial promises when the data is already on the client?