You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/docs/web-api/geolocation.md
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,21 @@ import demoFile from './geolocation.live.vue?raw';
58
58
59
59
## Additional capabilities
60
60
61
+
While creating an integration, you can override the default geolocation provider with your custom one. It can be done by passing an array of providers to the `trackGeolocation` function.
// by default providers field contains trackGeolocation.browserProvider
69
+
// which represents the browser built-in Geolocation API
70
+
providers: [trackGeolocation.browserProvider],
71
+
});
72
+
```
73
+
74
+
The logic is quite straightforward: integration will call providers one by one until one of them returns the location. The first provider that returns the location will be used.
75
+
61
76
### Regional restrictions
62
77
63
78
In some countries and regions, the use of geolocation can be restricted. If you are aiming to provide a service in such locations, you use some local providers to get the location of the user. For example, in China, you can use [Baidu](https://lbsyun.baidu.com/index.php?title=jspopular/guide/geolocation), [Autonavi](https://lbsyun.baidu.com/index.php?title=jspopular/guide/geolocation), or [Tencent](https://lbs.qq.com/webApi/component/componentGuide/componentGeolocation).
You can pass a [_Store_](https://effector.dev/docs/api/effector/store) to `providers` option to get a way to mock the geolocation provider during testing via [Fork API](/magazine/fork_api_rules).
That is it, any calculations on the created [_Scope_](https://effector.dev/docs/api/effector/scope) will use the `myFakeProvider` instead of the default one.
0 commit comments