Mrunay Uttarwar
Mrunay Uttarwar

@MrunayU

9 Tweets 1 reads Oct 30, 2022
πŸ”· About HTML Geolocation API - 2
A Thread🧡 πŸ‘‡
πŸ“Œ Handling Errors and Rejections
β†’ The second parameter of the getCurrentPosition() method is used to handle errors.
It specifies a function to run if it fails to get the user's location.
πŸ“Œ Location-specific Information
β†’ This has demonstrated how to show a user's position on a map.
β†’ Geolocation is also very useful for location-specific information, like:
β€’ Up-to-date local information
β€’ Showing Points-of-interest near the user
β€’ Turn-by-turn navigation (GPS)
πŸ“Œ The getCurrentPosition() Method- Return Data
β†’ The getCurrentPosition() method returns an object on success.
β†’ The latitude, longitude and accuracy properties are always returned. The other properties are returned if available.
πŸ“Œ Geolocation Object Other interesting Methods
β†’ The Geolocation object also has other interesting methods:
β€’ watchPosition() - Returns the current position of the user and continues to return updated position as the user moves (like the GPS in a car).
β€’ clearWatch() - Stops the watchPosition() method.
β†’ The example below shows the watchPosition() method.
β†’ You need an accurate GPS device to test this (like smartphone).
Thanks for reading this thread ❀️
If you like it , make sure you:
πŸ”· Like the tweet
πŸ”· Retweet the first tweet ⚑
For more content , follow:
@MrunayU
You can read the unrolled version of this thread here: typefully.com

Loading suggestions...