@octane-xplat/geolocation 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/package.json +1 -1
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# `@octane-xplat/geolocation`
|
|
2
2
|
|
|
3
|
-
Device geolocation behind one capability object. iOS and Android run
|
|
4
|
-
`@nativescript/geolocation`; web uses `navigator.geolocation`; the macOS
|
|
5
|
-
AppKit dev host reports `supported: false` (no CoreLocation bridge).
|
|
6
|
-
|
|
7
3
|
```sh
|
|
8
4
|
pnpm add @octane-xplat/geolocation
|
|
9
5
|
```
|
|
10
6
|
|
|
7
|
+
Device geolocation behind one capability object. iOS and Android run
|
|
8
|
+
`@nativescript/geolocation`; web uses `navigator.geolocation`; the macOS
|
|
9
|
+
AppKit dev host reports `supported: false` (no CoreLocation bridge).
|
|
10
|
+
|
|
11
11
|
```ts
|
|
12
12
|
import { geolocation } from '@octane-xplat/geolocation'
|
|
13
13
|
|
|
@@ -23,7 +23,16 @@ implementation exists on this target, `ensure()` resolves
|
|
|
23
23
|
defers the prompt), and `impl` is the service once usable. Nullable
|
|
24
24
|
`altitude`/`heading`/`speed` mean the platform did not report them.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
```ts
|
|
27
|
+
import { geolocation } from '@octane-xplat/geolocation'
|
|
28
|
+
|
|
29
|
+
if ((await geolocation.ensure()) === 'granted') {
|
|
30
|
+
const pos = await geolocation.impl!.getCurrentPosition()
|
|
31
|
+
// { latitude, longitude, accuracy, altitude, heading, speed, timestamp }
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Guide: [Using device features](../../docs/platform/platform-services.md);
|
|
36
|
+
per-target availability: [platform notes](../../docs/notes/platform-notes.md).
|
|
28
37
|
Exercised by the harness `Services` screen
|
|
29
38
|
([`packages/app/src/Services.tsrx`](../app/src/Services.tsrx)).
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Optional capability — never throws for absence (docs/platform-services.md). */
|
|
1
|
+
/** Optional capability — never throws for absence (docs/platform/platform-services.md). */
|
|
2
2
|
export interface Capability<T> {
|
|
3
3
|
supported: boolean
|
|
4
4
|
ensure(): Promise<'granted' | 'denied' | 'unsupported'>
|