Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Use promises across the board for unbound model-view interactions #687

Open
bruth opened this issue Sep 18, 2014 · 0 comments
Open

Use promises across the board for unbound model-view interactions #687

bruth opened this issue Sep 18, 2014 · 0 comments

Comments

@bruth
Copy link
Contributor

bruth commented Sep 18, 2014

In most cases, a view is bound to model and binds to the model or collections event's (using Marionette primarily). However in certain case views need to wait to load until two or more data are available. This is where promises are most useful.

A promise is created fetch some async operation is being executed (loading data from server). Once the response comes back the promise is either resolved or rejected which will executed all currently bound handlers, but will also immediately execute future handlers.

All calls to models or collections that invoke an Ajax call returns a promise, however they are not being used anywhere nor persisted until the next call is made. This prevents the ability to bind to the promise after the response has returned and results in needed to check if collection.length > 0 (which does not inform as to whether the ajax call has finished..).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants