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

DOMRequest vs. DOMFuture #1

Open
msporny opened this issue May 6, 2013 · 3 comments
Open

DOMRequest vs. DOMFuture #1

msporny opened this issue May 6, 2013 · 3 comments
Labels
Milestone

Comments

@msporny
Copy link
Member

msporny commented May 6, 2013

The DOMRequest API does not seem to have a spec yet. The DOMFuture spec exists and seems to have some uptake. We should decide whether or not the return value of the .payment() call should be a DOMFuture or a DOMRequest.

@kumar303
Copy link
Member

kumar303 commented May 6, 2013

I like DOMFuture better myself. Also, one thing we ran into with the current DOMRequest is that all it does is tell you if the window was closed. It became hard to work with DOMRequest when we wanted to introduce an intermediate "product catalog" service since there would be multiple callbacks such as windowClosed (the payment flow finished) or paymentCompleted (a valid server postback was received). We started some experiments on that here.

@msporny
Copy link
Member Author

msporny commented May 7, 2013

We implemented DOMFuture for the JSON-LD API and it was an... umm... interesting experience. They aren't as baked as we would have liked them to be. The other issue, as you outline above, may be that we might need to include multiple callbacks as options to the .pay()/.payment() method... and stuff like that doesn't tend to play very nicely with DOMFutures. @dlongley probably has more thoughts on this.

@dlongley
Copy link
Member

dlongley commented May 8, 2013

If we use DOMFutures, we would probably just resolve the Future to a different value (have a property in the result that indicated what happened) based on if the payment flow finished or a valid server postback was received -- or whatever other options we might be considering. This would have the same effect as having different callbacks, you would just have to check a property to determine what to call next. My guess would be that this will become the way things are done if DOMFutures gains wide adoption.

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

No branches or pull requests

3 participants