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

Update promise documentation #54

Merged
merged 1 commit into from
May 12, 2018
Merged

Conversation

kfarnung
Copy link
Member

@kfarnung kfarnung commented May 10, 2018

Needs to wait for chakra-core/ChakraCore#5131 to land.
Needs to wait for chakra-core/ChakraCore#5138 to land.

@kfarnung kfarnung self-assigned this May 10, 2018
@kfarnung kfarnung requested a review from liminzhu May 10, 2018 23:03
CHAKRA_API
JsGetPromiseResult(
_In_ JsValueRef *promise,
_Out_ JsPromiseState *statusCode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you've just copy/pasted from the other method; this should be a JsValueRef out parameter I believe.

@liminzhu
Copy link
Member

Thanks for keeping the docs updated!

Comments on documentation

  1. Consider documenting behavior of JsGetPromiseResult when promise is pending (JsErrorInvalidArgument currently) and rejected (error object). At least the pending behavior isn't very obvious.

I hope it's not too late for comments on those APIs themselves

  1. Most of our enums don't use _. Consider something like JsPromiseStatePending.
  2. This is debatable - I'm not sure about JsGetPromiseResult returning JsErrorInvalidArgument from pending promises. Intuitively, I only expect this if you throw in something other than promise. You can have a valid argument (a promise) but just catch it in a bad state. I'd suggest returning JS_INVALID_REFERENCE if you consider this a valid and successful operation or a new error code like JsErrorPendingPromise for a failed op.

@kfarnung
Copy link
Member Author

@liminzhu I made the documentation changes to resolve your feedback, but it's pending another change to ChakraCore before this can land.

@kfarnung
Copy link
Member Author

Opened chakra-core/ChakraCore#5138

@kfarnung
Copy link
Member Author

@liminzhu @MSLaguana Any other concerns with this documentation?

@liminzhu
Copy link
Member

LGTM, thx!

@kfarnung kfarnung merged commit e6f0a39 into microsoft:master May 12, 2018
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.

3 participants