Description
The geolocation API requires use of callbacks rather than being promise based like modern APIs. However, there is room to offer a promise alternative. If we make the callbacks optional, in the case where they're undefined we could return a promise. This was previously done for Notification.requestPermission. This feels like it should be a relatively simple change to make to the API that little bit more intuitive for new developers.
It'll probably never be possible to deprecate the old syntax but at least it would improve newer code.
The only slightly unfortunate bit would be that setting the options param might need to be done like await navigator.geolocation.getCurrentPosition(undefined, undefined, {...})
, this also wouldn't be the first time a parameter needs to be set to an empty value, the same is common for history.pushState()
It feels like watchPosition should/could be updated too but I can't think what that would look like given it fires multiple times?