Giving DataStore a Promise
By returning Deferreds from RemoteDataStore’s methods, you have a flexible way to use the data sent back from the server.
But you may have noticed that RemoteDataStore’s methods now stray far away from how DataStore’s methods work. If you were to swap a regular DataStore back in, you would see that it no longer works with your application (Figure 14.6).
Figure 14.6 Uh oh. DataStore is no longer compatible
In Figure 14.6, you can see that instantiating a Truck
with a regular DataStore throws errors and fails to work correctly
with the UI. CoffeeRun expects a Promise
-based DataStore in order to function ...
Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.