Skip to content
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

First pass at resolve #3

Closed
wants to merge 8 commits into from
Closed

First pass at resolve #3

wants to merge 8 commits into from

Conversation

christopherthielen
Copy link
Collaborator

Nate, I'm halfway through this code.

I'm trying to encapsulate the resolve functionality. I added PathElement and Resolvable types. Resolvable is trying to encapsulate one state resolve and the lifecycle around it. It tracks:

  • resolve name and resolveFn injectable
  • what the resolveFn depends on, (strings: either other resolves or anything else injectable)
  • The resolvable's promise, if it has been invoked.
  • The unwrapped data from the promise
  • invoke status (has the resolveFn been invoked yet)

The resolve function:

  • maps param1 ancestorResolvables array by name
  • removes any resolves that this resolve doesn't depend on
  • invokes any dependency resolveFn that haven't been invoked yet (I did this to handle your comment in Resolve notes #2)
  • waits for all the dependencies's promises to be resolved, then
    • unwraps the dependencies promises and calls them locals
    • invokes the current Resolvable's resolveFn with the locals

@nateabele
Copy link
Owner

Finally (mentally) made it through most of this. Looks awesome so far. Nailed it. Lemme know when you feel like it's finalized.

@christopherthielen
Copy link
Collaborator Author

cool. Were you looking at lint branch or resolves branch? resolves obviously has the latest work in it. The comments in this issue are somewhat obsolete too, btw, #4 has more accurate comments.

@nateabele
Copy link
Owner

Was looking at lint. Checking out #4 now.

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

Successfully merging this pull request may close these issues.

2 participants