Skip to content
Discussion options

You must be logged in to vote

The getCurrentPosition API [1] is a little tricky to wrap because it accepts success and error callback functions rather than being awaitable itself. So to make it work with call_function's callback mechanism, we need to wrap it in our own Promise which Reflex frontend will await for before sending the result to the backend where we will pick it apart with an event handler.

I have defined the shape of the API objects in python to make them natural to work with and allow the type checker to help us catch errors. For some APIs where the Javascript object cannot be represented in JSON, it might be necessary to return a modified object on the frontend that can be serialized, however my recomm…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fromualdi
Comment options

Answer selected by masenf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants