-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Allowing onBeforePrint to return a Promise #146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for jumping on this! Just a few minor things and then I think we'll be good to go (we'll have to release this under a breaking change but I think that's ok)
@MatthewHerbst Why is this a breaking change? we still allow the onBeforePrint function to return void. |
This line: onBeforePrintOutput instanceof Promise will break if var x = {}
x instanceof Promise
// Error: "'Promise' is undefined" So the implementation as it would still require users to polyfill Maybe there is another way to check if something is a |
Apparently, there is no standardized way: This is the es5 answer that we can use (and graphql-js use): So it would look like this: What do you think? |
I'm ok with that. It's not 100% perfect (as some commenters in the accepted answer of that SO post point out) but I think it's good enough |
@MatthewHerbst Done - changed the way to check if it's a promise. |
Awesome! One last request: can you please squash the commits together? |
@MatthewHerbst Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks! I'll get a new version with this published in a little bit
Published as v2.2.0. Thanks again! |
#140