Skip to content

Commit

Permalink
fix(useGeolocation): Implement immediate option (#2472)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebisbe committed Dec 16, 2022
1 parent 8c8a0c6 commit 161fdb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/useGeolocation/index.ts
Expand Up @@ -23,6 +23,7 @@ export function useGeolocation(options: UseGeolocationOptions = {}) {
maximumAge = 30000,
timeout = 27000,
navigator = defaultNavigator,
immediate = true,
} = options

const isSupported = useSupported(() => navigator && 'geolocation' in navigator)
Expand Down Expand Up @@ -61,7 +62,8 @@ export function useGeolocation(options: UseGeolocationOptions = {}) {
}
}

resume()
if (immediate)
resume()

function pause() {
if (watcher && navigator)
Expand Down

0 comments on commit 161fdb0

Please sign in to comment.