Kai Wieland
Kai Wieland

Reputation: 11

How to use navigator.geolocation.getCurrentPosition in Haxe?

Maybe somebody can tell me how I will use navigator.geolocation.getCurrentPosition in Haxe. In JavaScript this method needs 2 callback functions (success/error) and an option object. In the Haxe version of this method, the successCallback is typed as Position and the errorCallback is typed as PositionError. How do I use getCurrentPosition method in Haxe?

Upvotes: 1

Views: 127

Answers (1)

back2dos
back2dos

Reputation: 15623

In the Haxe version of this method, the successCallback is typed as Position and the errorCallback is typed as PositionError.

This is inaccurate. The documentation states:

  • successCallback:Position ‑> Void
    this must be a callback accepting one argument of type Position
  • ?errorCallback:PositionError ‑> Void
    this is an optional callback acception one argument of type PositionError
  • ?options:PositionOptions
    these are optional PositionOptions

Here's a runnable example: http://try.haxe.org/#5EE17

Upvotes: 1

Related Questions