Skip to content

Note what defer.resolve and defer.reject do. Closes gh-693 #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

kswedberg
Copy link
Member

Added brief description of defer.resolve and defer.reject. @AurelioDeRosa , do you think this should cover gh-693?

@AurelioDeRosa
Copy link
Member

The added sentence is fine and the PR looks good. I also think it covers gh-693.

I'd also take the chance to slightly clarify the sentence

If the promise already exists, however, the callback is attached to the existing deferred.

We have two cases in the code:

  1. The promise didn't exist
  2. The promise existed

In the first case, the promise is created (in the body of if ( !cachedScriptPromises[ url ] ) {...}) and then the callback is added. In the second case, the body of the if is skipped but the callback is added anyway. So, what about something like

If the promise already exists, the callback is attached to the existing deferred; otherwise the promise is firstly created and then the callback is attached.

@kswedberg
Copy link
Member Author

@AurelioDeRosa , yeah I like your change. Thanks! I'll update the PR.

@kswedberg
Copy link
Member Author

All good now?

@AurelioDeRosa
Copy link
Member

LGTM

@kswedberg
Copy link
Member Author

Closed by d08015a

@kswedberg kswedberg closed this Mar 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants