From 4c7657c948f0e95c781965d0c52aba7297e4311d Mon Sep 17 00:00:00 2001 From: Enric Bisbe Gil Date: Wed, 23 Nov 2022 11:18:56 +0100 Subject: [PATCH] Use immediate option with default to true --- packages/core/useGeolocation/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/useGeolocation/index.ts b/packages/core/useGeolocation/index.ts index bd8696344f1..1108354b845 100644 --- a/packages/core/useGeolocation/index.ts +++ b/packages/core/useGeolocation/index.ts @@ -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) @@ -61,7 +62,8 @@ export function useGeolocation(options: UseGeolocationOptions = {}) { } } - resume() + if (immediate) + resume() function pause() { if (watcher && navigator)