@symbiote-native/sensors 0.2.1 → 0.4.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 +61 -21
- package/build/angular/index.d.ts +1 -1
- package/build/angular/index.js +1 -1
- package/build/angular/services/accelerometer.service/index.js +8 -13
- package/build/angular/services/barometer.service/index.js +8 -13
- package/build/angular/services/device-motion.service/index.js +8 -13
- package/build/angular/services/gyroscope.service/index.js +8 -13
- package/build/angular/services/light-sensor.service/index.js +8 -13
- package/build/angular/services/magnetometer-uncalibrated.service/index.js +10 -14
- package/build/angular/services/magnetometer.service/index.js +8 -13
- package/build/angular/services/pedometer.service/index.js +7 -11
- package/build/core/device-motion.js +3 -4
- package/build/core/index.d.ts +5 -5
- package/build/core/index.js +5 -5
- package/build/react/hooks/use-magnetometer-uncalibrated/index.js +1 -1
- package/build/react/index.d.ts +1 -1
- package/build/react/index.js +1 -1
- package/build/solid/index.d.ts +10 -0
- package/build/solid/index.js +17 -0
- package/build/solid/primitives/create-accelerometer.d.ts +4 -0
- package/build/solid/primitives/create-accelerometer.js +5 -0
- package/build/solid/primitives/create-barometer.d.ts +4 -0
- package/build/solid/primitives/create-barometer.js +5 -0
- package/build/solid/primitives/create-device-motion.d.ts +4 -0
- package/build/solid/primitives/create-device-motion.js +5 -0
- package/build/solid/primitives/create-gyroscope.d.ts +4 -0
- package/build/solid/primitives/create-gyroscope.js +5 -0
- package/build/solid/primitives/create-light-sensor.d.ts +4 -0
- package/build/solid/primitives/create-light-sensor.js +5 -0
- package/build/solid/primitives/create-magnetometer-uncalibrated.d.ts +4 -0
- package/build/solid/primitives/create-magnetometer-uncalibrated.js +5 -0
- package/build/solid/primitives/create-magnetometer.d.ts +4 -0
- package/build/solid/primitives/create-magnetometer.js +5 -0
- package/build/solid/primitives/create-pedometer.d.ts +3 -0
- package/build/solid/primitives/create-pedometer.js +22 -0
- package/build/solid/primitives/device-sensor-accessor.d.ts +9 -0
- package/build/solid/primitives/device-sensor-accessor.js +66 -0
- package/build/svelte/index.d.ts +16 -0
- package/build/svelte/index.js +14 -0
- package/build/svelte/runes/use-accelerometer.svelte.d.ts +4 -0
- package/build/svelte/runes/use-accelerometer.svelte.js +31 -0
- package/build/svelte/runes/use-barometer.svelte.d.ts +4 -0
- package/build/svelte/runes/use-barometer.svelte.js +22 -0
- package/build/svelte/runes/use-device-motion.svelte.d.ts +4 -0
- package/build/svelte/runes/use-device-motion.svelte.js +22 -0
- package/build/svelte/runes/use-gyroscope.svelte.d.ts +4 -0
- package/build/svelte/runes/use-gyroscope.svelte.js +22 -0
- package/build/svelte/runes/use-light-sensor.svelte.d.ts +4 -0
- package/build/svelte/runes/use-light-sensor.svelte.js +22 -0
- package/build/svelte/runes/use-magnetometer-uncalibrated.svelte.d.ts +4 -0
- package/build/svelte/runes/use-magnetometer-uncalibrated.svelte.js +22 -0
- package/build/svelte/runes/use-magnetometer.svelte.d.ts +4 -0
- package/build/svelte/runes/use-magnetometer.svelte.js +22 -0
- package/build/svelte/runes/use-pedometer.svelte.d.ts +4 -0
- package/build/svelte/runes/use-pedometer.svelte.js +20 -0
- package/build/vue/composables/use-barometer/index.js +1 -1
- package/build/vue/composables/use-device-motion/index.js +1 -1
- package/build/vue/composables/use-gyroscope/index.js +1 -1
- package/build/vue/composables/use-light-sensor/index.js +1 -1
- package/build/vue/composables/use-magnetometer/index.js +1 -1
- package/build/vue/composables/use-pedometer/index.js +1 -1
- package/build/vue/index.d.ts +1 -1
- package/build/vue/index.js +1 -1
- package/build-ngc/angular/index.d.ts +1 -1
- package/build-ngc/angular/index.js +1 -1
- package/build-ngc/angular/index.js.map +1 -1
- package/build-ngc/angular/services/accelerometer.service/index.js +11 -16
- package/build-ngc/angular/services/accelerometer.service/index.js.map +1 -1
- package/build-ngc/angular/services/barometer.service/index.js +11 -16
- package/build-ngc/angular/services/barometer.service/index.js.map +1 -1
- package/build-ngc/angular/services/device-motion.service/index.js +11 -16
- package/build-ngc/angular/services/device-motion.service/index.js.map +1 -1
- package/build-ngc/angular/services/gyroscope.service/index.js +11 -16
- package/build-ngc/angular/services/gyroscope.service/index.js.map +1 -1
- package/build-ngc/angular/services/light-sensor.service/index.js +11 -16
- package/build-ngc/angular/services/light-sensor.service/index.js.map +1 -1
- package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js +13 -17
- package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js.map +1 -1
- package/build-ngc/angular/services/magnetometer.service/index.js +11 -16
- package/build-ngc/angular/services/magnetometer.service/index.js.map +1 -1
- package/build-ngc/angular/services/pedometer.service/index.js +10 -14
- package/build-ngc/angular/services/pedometer.service/index.js.map +1 -1
- package/build-ngc/core/barometer.js.map +1 -1
- package/build-ngc/core/device-motion.js +3 -4
- package/build-ngc/core/device-motion.js.map +1 -1
- package/build-ngc/core/device-sensor.js.map +1 -1
- package/build-ngc/core/gyroscope.js.map +1 -1
- package/build-ngc/core/index.d.ts +5 -5
- package/build-ngc/core/index.js +5 -5
- package/build-ngc/core/index.js.map +1 -1
- package/build-ngc/core/magnetometer-uncalibrated.js.map +1 -1
- package/build-ngc/core/native/exponent-barometer.js.map +1 -1
- package/build-ngc/core/native/exponent-device-motion.js.map +1 -1
- package/build-ngc/core/native/exponent-gyroscope.js.map +1 -1
- package/build-ngc/core/native/exponent-light-sensor/index.ios.js.map +1 -1
- package/build-ngc/core/native/exponent-magnetometer-uncalibrated.js.map +1 -1
- package/build-ngc/core/native/exponent-pedometer.js.map +1 -1
- package/build-ngc/core/pedometer.js.map +1 -1
- package/package.json +42 -14
- package/src/angular/index.ts +5 -1
- package/src/angular/services/accelerometer.service/index.ts +18 -14
- package/src/angular/services/barometer.service/index.ts +18 -14
- package/src/angular/services/device-motion.service/index.ts +18 -14
- package/src/angular/services/gyroscope.service/index.ts +18 -14
- package/src/angular/services/light-sensor.service/index.ts +18 -14
- package/src/angular/services/magnetometer-uncalibrated.service/index.ts +29 -17
- package/src/angular/services/magnetometer.service/index.ts +18 -14
- package/src/angular/services/pedometer.service/index.ts +14 -11
- package/src/core/barometer.ts +4 -1
- package/src/core/device-motion.ts +15 -6
- package/src/core/device-sensor.ts +8 -2
- package/src/core/gyroscope.ts +4 -1
- package/src/core/index.ts +25 -5
- package/src/core/magnetometer-uncalibrated.ts +2 -1
- package/src/core/native/exponent-barometer.ts +3 -3
- package/src/core/native/exponent-device-motion.ts +8 -6
- package/src/core/native/exponent-gyroscope.ts +3 -3
- package/src/core/native/exponent-light-sensor/index.ios.ts +7 -6
- package/src/core/native/exponent-magnetometer-uncalibrated.ts +2 -1
- package/src/core/native/exponent-pedometer.ts +4 -1
- package/src/core/pedometer.ts +7 -2
- package/src/react/hooks/use-accelerometer/index.ts +5 -2
- package/src/react/hooks/use-barometer/index.ts +6 -2
- package/src/react/hooks/use-device-motion/index.ts +5 -2
- package/src/react/hooks/use-gyroscope/index.ts +6 -2
- package/src/react/hooks/use-light-sensor/index.ts +5 -2
- package/src/react/hooks/use-magnetometer/index.ts +5 -2
- package/src/react/hooks/use-magnetometer-uncalibrated/index.ts +6 -2
- package/src/react/index.ts +5 -1
- package/src/solid/index.ts +19 -0
- package/src/solid/primitives/create-accelerometer.ts +16 -0
- package/src/solid/primitives/create-barometer.ts +16 -0
- package/src/solid/primitives/create-device-motion.ts +16 -0
- package/src/solid/primitives/create-gyroscope.ts +16 -0
- package/src/solid/primitives/create-light-sensor.ts +16 -0
- package/src/solid/primitives/create-magnetometer-uncalibrated.ts +19 -0
- package/src/solid/primitives/create-magnetometer.ts +16 -0
- package/src/solid/primitives/create-pedometer.ts +31 -0
- package/src/solid/primitives/device-sensor-accessor.ts +105 -0
- package/src/svelte/index.ts +33 -0
- package/src/svelte/runes/use-accelerometer.svelte.ts +40 -0
- package/src/svelte/runes/use-barometer.svelte.ts +31 -0
- package/src/svelte/runes/use-device-motion.svelte.ts +31 -0
- package/src/svelte/runes/use-gyroscope.svelte.ts +31 -0
- package/src/svelte/runes/use-light-sensor.svelte.ts +31 -0
- package/src/svelte/runes/use-magnetometer-uncalibrated.svelte.ts +32 -0
- package/src/svelte/runes/use-magnetometer.svelte.ts +31 -0
- package/src/svelte/runes/use-pedometer.svelte.ts +27 -0
- package/src/svelte/svelte-ambient.d.ts +6 -0
- package/src/vue/composables/use-accelerometer/index.ts +3 -1
- package/src/vue/composables/use-barometer/index.ts +8 -2
- package/src/vue/composables/use-device-motion/index.ts +8 -2
- package/src/vue/composables/use-gyroscope/index.ts +8 -2
- package/src/vue/composables/use-light-sensor/index.ts +8 -2
- package/src/vue/composables/use-magnetometer/index.ts +8 -2
- package/src/vue/composables/use-pedometer/index.ts +5 -1
- package/src/vue/index.ts +5 -1
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
A wrapper package for [SymbioteNative](../../README.md) that makes
|
|
4
4
|
[`expo-sensors`](https://github.com/expo/expo/tree/main/packages/expo-sensors) — Accelerometer,
|
|
5
5
|
Barometer, DeviceMotion, Gyroscope, LightSensor, Magnetometer, MagnetometerUncalibrated, and
|
|
6
|
-
Pedometer — usable from **every** adapter, React, Vue, and Angular. Unlike this
|
|
7
|
-
wrappers ([`@symbiote-native/slider`](../slider), [`@symbiote-native/navigation`](../navigation),
|
|
6
|
+
Pedometer — usable from **every** adapter, React, Vue, Svelte, Solid, and Angular. Unlike this
|
|
7
|
+
repo's other wrappers ([`@symbiote-native/slider`](../slider), [`@symbiote-native/navigation`](../navigation),
|
|
8
8
|
[`@symbiote-native/splash-screen`](../splash-screen)), `expo-sensors` isn't a plain RN native
|
|
9
9
|
module or view — it's built on `expo-modules-core`, so its native code autolinks straight out of
|
|
10
10
|
`node_modules` via `expo-modules-autolinking`, no proxy `react-native.config.cjs`/podspec to ship.
|
|
@@ -29,12 +29,12 @@ Unlike a plain RN native module, `expo-sensors`' native code is discovered by
|
|
|
29
29
|
into the native host app **once**, covering this package and every future `expo-modules-core`
|
|
30
30
|
package with zero further changes:
|
|
31
31
|
|
|
32
|
-
| Platform | Touches
|
|
33
|
-
|
|
34
|
-
| iOS
|
|
35
|
-
| iOS
|
|
36
|
-
| Android
|
|
37
|
-
| Android
|
|
32
|
+
| Platform | Touches |
|
|
33
|
+
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| iOS | `ios/Podfile` — add `use_expo_modules!` |
|
|
35
|
+
| iOS | `AppDelegate.swift` — Expo's runtime-bootstrap hook |
|
|
36
|
+
| Android | `settings.gradle` / `app/build.gradle` — resolve and include the Expo Gradle projects |
|
|
37
|
+
| Android | `MainApplication.kt` — Expo's bootstrap hook, plus a hand-written native-module name map (there's no `expo` meta-package here to auto-generate one) |
|
|
38
38
|
|
|
39
39
|
Full mechanics — the Podfile pieces that normally ship inside the `expo` package, the `expo`
|
|
40
40
|
peer-dependency exclusion list, per-sensor permission strings — live in the
|
|
@@ -55,12 +55,16 @@ src/core/ DeviceSensor base class + one class per sensor (Accelerome
|
|
|
55
55
|
module by name through expo-modules-core's requireNativeModule.
|
|
56
56
|
src/react/hooks/ @symbiote-native/sensors/react — useAccelerometer, useBarometer, ...
|
|
57
57
|
src/vue/composables/ @symbiote-native/sensors/vue — useAccelerometer, useBarometer, ... (same names)
|
|
58
|
+
src/svelte/runes/ @symbiote-native/sensors/svelte — useAccelerometer, useBarometer, ... (same names)
|
|
59
|
+
src/solid/primitives/ @symbiote-native/sensors/solid — createAccelerometer, createBarometer, ...
|
|
58
60
|
src/angular/services/ @symbiote-native/sensors/angular — AccelerometerService, BarometerService, ...
|
|
59
61
|
```
|
|
60
62
|
|
|
61
|
-
Each adapter's hook/composable/service is a thin lifecycle wrapper (subscribe on
|
|
62
|
-
on unmount) over the same `core` singleton — the subscription, permission, and
|
|
63
|
-
logic is written once and shared by all
|
|
63
|
+
Each adapter's hook/composable/rune/primitive/service is a thin lifecycle wrapper (subscribe on
|
|
64
|
+
mount, unsubscribe on unmount) over the same `core` singleton — the subscription, permission, and
|
|
65
|
+
update-interval logic is written once and shared by all of them. Solid is the one adapter that
|
|
66
|
+
renames: its ecosystem calls a composable reactive function a **primitive** and reserves `use*` for
|
|
67
|
+
consuming something that already exists, so `useAccelerometer` is `createAccelerometer` there.
|
|
64
68
|
|
|
65
69
|
## Use it
|
|
66
70
|
|
|
@@ -72,7 +76,12 @@ import { useAccelerometer } from '@symbiote-native/sensors/react';
|
|
|
72
76
|
|
|
73
77
|
function SensorsScreen() {
|
|
74
78
|
const accelerometer = useAccelerometer();
|
|
75
|
-
return
|
|
79
|
+
return (
|
|
80
|
+
<Text>
|
|
81
|
+
{accelerometer &&
|
|
82
|
+
`x ${accelerometer.x} · y ${accelerometer.y} · z ${accelerometer.z}`}
|
|
83
|
+
</Text>
|
|
84
|
+
);
|
|
76
85
|
}
|
|
77
86
|
```
|
|
78
87
|
|
|
@@ -84,34 +93,65 @@ import { useAccelerometer } from '@symbiote-native/sensors/vue';
|
|
|
84
93
|
const accelerometer = useAccelerometer();
|
|
85
94
|
</script>
|
|
86
95
|
<template>
|
|
87
|
-
<Text>{{
|
|
96
|
+
<Text>{{
|
|
97
|
+
accelerometer &&
|
|
98
|
+
`x ${accelerometer.x} · y ${accelerometer.y} · z ${accelerometer.z}`
|
|
99
|
+
}}</Text>
|
|
88
100
|
</template>
|
|
89
101
|
```
|
|
90
102
|
|
|
103
|
+
```tsx
|
|
104
|
+
// Solid — a primitive returning an Accessor, read as `accelerometer()`. `Show` must be imported
|
|
105
|
+
// explicitly (see .claude/rules/solid-descriptor-bridge.md), and hands its child an accessor.
|
|
106
|
+
import { Show } from 'solid-js';
|
|
107
|
+
import { createAccelerometer } from '@symbiote-native/sensors/solid';
|
|
108
|
+
|
|
109
|
+
function SensorsScreen() {
|
|
110
|
+
const accelerometer = createAccelerometer();
|
|
111
|
+
return (
|
|
112
|
+
<Text>
|
|
113
|
+
<Show when={accelerometer()}>
|
|
114
|
+
{reading => `x ${reading().x} · y ${reading().y} · z ${reading().z}`}
|
|
115
|
+
</Show>
|
|
116
|
+
</Text>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
91
121
|
```ts
|
|
92
122
|
// Angular
|
|
93
123
|
import { Component, inject } from '@angular/core';
|
|
94
124
|
import { AccelerometerService } from '@symbiote-native/sensors/angular';
|
|
95
125
|
|
|
96
|
-
@Component({
|
|
126
|
+
@Component({/* ... */})
|
|
97
127
|
export class SensorsScreen {
|
|
98
128
|
readonly accelerometer = inject(AccelerometerService).connect();
|
|
99
129
|
}
|
|
100
130
|
```
|
|
101
131
|
|
|
102
|
-
|
|
132
|
+
The examples above mirror the real canary demo screens —
|
|
103
133
|
`examples/expo-react/screens/SensorsScreen.tsx`, `examples/expo-vue-sfc/screens/SensorsScreen.vue`,
|
|
104
134
|
`examples/expo-vue-tsx/screens/SensorsScreen.tsx`, `examples/expo-angular/src/screens/SensorsScreen.ts`.
|
|
105
135
|
|
|
106
|
-
Every hook/composable/`connect()` takes an optional `updateIntervalMs` and returns
|
|
107
|
-
first native reading arrives — check `isAvailableAsync()` separately if you need
|
|
108
|
-
"not available on this device" from "no reading yet" (see [Notes](#notes) below).
|
|
136
|
+
Every hook/composable/rune/primitive/`connect()` takes an optional `updateIntervalMs` and returns
|
|
137
|
+
`null` until the first native reading arrives — check `isAvailableAsync()` separately if you need
|
|
138
|
+
to distinguish "not available on this device" from "no reading yet" (see [Notes](#notes) below).
|
|
139
|
+
|
|
140
|
+
On Solid `updateIntervalMs` accepts an **accessor** as well as a number
|
|
141
|
+
(`createAccelerometer(() => intervalMs())`). A Solid component body runs once, so a plain number is
|
|
142
|
+
read once and pins the sample rate for the primitive's whole life; pass the accessor whenever the
|
|
143
|
+
rate is derived from state and it re-applies on every change — without re-subscribing, since the
|
|
144
|
+
native listener is per-sensor and unaffected by the rate.
|
|
109
145
|
|
|
110
146
|
### Pedometer — free functions, no shared instance
|
|
111
147
|
|
|
112
148
|
```ts
|
|
113
|
-
import {
|
|
114
|
-
|
|
149
|
+
import {
|
|
150
|
+
watchStepCount,
|
|
151
|
+
getStepCountAsync,
|
|
152
|
+
isAvailableAsync,
|
|
153
|
+
} from '@symbiote-native/sensors';
|
|
154
|
+
import { usePedometer } from '@symbiote-native/sensors/react'; // or /vue, /svelte, /solid's createPedometer, /angular's PedometerService
|
|
115
155
|
|
|
116
156
|
const pedometer = usePedometer(); // { steps: number } | null, live-subscribed
|
|
117
157
|
const { steps } = await getStepCountAsync(startDate, endDate); // one-shot, iOS only in practice
|
|
@@ -134,5 +174,5 @@ const { steps } = await getStepCountAsync(startDate, endDate); // one-shot, iOS
|
|
|
134
174
|
|
|
135
175
|
No Fabric/Descriptor angle at all — a sensor is a pure `EventEmitter` + async-function surface,
|
|
136
176
|
never a view. Tests inject a fake native-module object in place of the real
|
|
137
|
-
`requireNativeModule` resolution (`src/core/**/*.test.ts`, `src/{react,vue,angular}/**/*.test.{ts,tsx}`),
|
|
177
|
+
`requireNativeModule` resolution (`src/core/**/*.test.ts`, `src/{react,vue,svelte,solid,angular}/**/*.test.{ts,tsx}`),
|
|
138
178
|
the same pattern `expo-sensors` itself uses upstream — no `installFabric()`, no ViewConfig.
|
package/build/angular/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { IAccelerometerMeasurement } from '../core';
|
|
|
3
3
|
export { BarometerService } from './services/barometer.service';
|
|
4
4
|
export type { IBarometerMeasurement } from '../core';
|
|
5
5
|
export { DeviceMotionService } from './services/device-motion.service';
|
|
6
|
-
export { DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement } from '../core';
|
|
6
|
+
export { DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement, } from '../core';
|
|
7
7
|
export { GyroscopeService } from './services/gyroscope.service';
|
|
8
8
|
export type { IGyroscopeMeasurement } from '../core';
|
|
9
9
|
export { LightSensorService } from './services/light-sensor.service';
|
package/build/angular/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export { AccelerometerService } from './services/accelerometer.service/index.js';
|
|
4
4
|
export { BarometerService } from './services/barometer.service/index.js';
|
|
5
5
|
export { DeviceMotionService } from './services/device-motion.service/index.js';
|
|
6
|
-
export { DeviceMotionOrientation, gravity } from '../core/index.js';
|
|
6
|
+
export { DeviceMotionOrientation, gravity, } from '../core/index.js';
|
|
7
7
|
export { GyroscopeService } from './services/gyroscope.service/index.js';
|
|
8
8
|
export { LightSensorService } from './services/light-sensor.service/index.js';
|
|
9
9
|
export { MagnetometerService } from './services/magnetometer.service/index.js';
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { Accelerometer } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useAccelerometer` hook
|
|
38
|
-
// Angular has no per-instance hook
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useAccelerometer` hook / Vue's `useAccelerometer` composable.
|
|
38
|
+
// Angular has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection
|
|
39
|
+
// context (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(AccelerometerService).connect();
|
|
43
42
|
// // template: {{ measurement()?.x }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let AccelerometerService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let AccelerometerService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
Accelerometer.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { Barometer } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useBarometer` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useBarometer` hook / Vue's `useBarometer` composable. Angular has no
|
|
38
|
+
// per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(BarometerService).connect();
|
|
43
42
|
// // template: {{ measurement()?.pressure }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let BarometerService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let BarometerService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
Barometer.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { DeviceMotion } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useDeviceMotion` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useDeviceMotion` hook / Vue's `useDeviceMotion` composable. Angular
|
|
38
|
+
// has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(DeviceMotionService).connect();
|
|
43
42
|
// // template: {{ measurement()?.rotation?.alpha }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let DeviceMotionService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let DeviceMotionService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
DeviceMotion.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { Gyroscope } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useGyroscope` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useGyroscope` hook / Vue's `useGyroscope` composable. Angular has no
|
|
38
|
+
// per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(GyroscopeService).connect();
|
|
43
42
|
// // template: {{ measurement()?.x }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let GyroscopeService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let GyroscopeService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
Gyroscope.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { LightSensor } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useLightSensor` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useLightSensor` hook / Vue's `useLightSensor` composable. Angular
|
|
38
|
+
// has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(LightSensorService).connect();
|
|
43
42
|
// // template: {{ measurement()?.illuminance }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let LightSensorService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let LightSensorService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
LightSensor.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,20 +32,15 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
36
|
-
import { MagnetometerUncalibrated } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useMagnetometerUncalibrated` hook
|
|
38
|
-
// `useMagnetometerUncalibrated` composable. Angular has no per-instance hook
|
|
39
|
-
//
|
|
40
|
-
//
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
|
+
import { MagnetometerUncalibrated, } from '../../../core/index.js';
|
|
37
|
+
// Angular twin of React's `useMagnetometerUncalibrated` hook / Vue's
|
|
38
|
+
// `useMagnetometerUncalibrated` composable. Angular has no per-instance hook, so `connect()`
|
|
39
|
+
// stands in: call it ONCE, inside an injection context (typically a component's field
|
|
40
|
+
// initializer).
|
|
41
41
|
//
|
|
42
42
|
// readonly measurement = inject(MagnetometerUncalibratedService).connect();
|
|
43
43
|
// // template: {{ measurement()?.x }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
44
|
let MagnetometerUncalibratedService = (() => {
|
|
50
45
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
46
|
let _classDescriptor;
|
|
@@ -60,13 +55,14 @@ let MagnetometerUncalibratedService = (() => {
|
|
|
60
55
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
56
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
57
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
58
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
59
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
60
|
injector = inject(Injector);
|
|
67
61
|
connect(updateIntervalMs) {
|
|
68
62
|
const measurement = signal(null);
|
|
69
63
|
effect(onCleanup => {
|
|
64
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
65
|
+
// re-run on, so a later change is not picked up.
|
|
70
66
|
if (updateIntervalMs !== undefined) {
|
|
71
67
|
MagnetometerUncalibrated.setUpdateInterval(updateIntervalMs);
|
|
72
68
|
}
|
|
@@ -32,20 +32,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { Magnetometer } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `useMagnetometer` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// inside an injection context).
|
|
37
|
+
// Angular twin of React's `useMagnetometer` hook / Vue's `useMagnetometer` composable. Angular
|
|
38
|
+
// has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer).
|
|
41
40
|
//
|
|
42
41
|
// readonly measurement = inject(MagnetometerService).connect();
|
|
43
42
|
// // template: {{ measurement()?.x }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
46
|
-
// subscription doesn't depend on anything the caller's own signals could change between
|
|
47
|
-
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
48
|
-
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
49
43
|
let MagnetometerService = (() => {
|
|
50
44
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
51
45
|
let _classDescriptor;
|
|
@@ -60,13 +54,14 @@ let MagnetometerService = (() => {
|
|
|
60
54
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
61
55
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
62
56
|
}
|
|
63
|
-
// Captured in the constructor (
|
|
64
|
-
//
|
|
65
|
-
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
57
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
58
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
66
59
|
injector = inject(Injector);
|
|
67
60
|
connect(updateIntervalMs) {
|
|
68
61
|
const measurement = signal(null);
|
|
69
62
|
effect(onCleanup => {
|
|
63
|
+
// updateIntervalMs applies once, at connect time — the effect has no reactive read to
|
|
64
|
+
// re-run on, so a later change is not picked up.
|
|
70
65
|
if (updateIntervalMs !== undefined) {
|
|
71
66
|
Magnetometer.setUpdateInterval(updateIntervalMs);
|
|
72
67
|
}
|
|
@@ -32,18 +32,15 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
35
|
+
import { effect, inject, Injectable, Injector, signal, } from '@angular/core';
|
|
36
36
|
import { watchStepCount } from '../../../core/index.js';
|
|
37
|
-
// Angular twin of React's `usePedometer` hook
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
37
|
+
// Angular twin of React's `usePedometer` hook / Vue's `usePedometer` composable. Angular has no
|
|
38
|
+
// per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
|
|
39
|
+
// (typically a component's field initializer). Pedometer has no setUpdateInterval, unlike the
|
|
40
|
+
// other sensor services, so there is no interval param here.
|
|
41
41
|
//
|
|
42
42
|
// readonly result = inject(PedometerService).connect();
|
|
43
43
|
// // template: {{ result()?.steps }}
|
|
44
|
-
//
|
|
45
|
-
// Unlike AccelerometerService.connect(), there is no updateIntervalMs to apply — Pedometer has
|
|
46
|
-
// no setUpdateInterval — so a single effect() that subscribes once and cleans up once is enough.
|
|
47
44
|
let PedometerService = (() => {
|
|
48
45
|
let _classDecorators = [Injectable({ providedIn: 'root' })];
|
|
49
46
|
let _classDescriptor;
|
|
@@ -58,9 +55,8 @@ let PedometerService = (() => {
|
|
|
58
55
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
59
56
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
60
57
|
}
|
|
61
|
-
// Captured in the constructor (
|
|
62
|
-
//
|
|
63
|
-
// code that is not, on its own, an active injection context — mirrors AccelerometerService.
|
|
58
|
+
// Captured in the constructor (always an injection context) so `connect()` can build an
|
|
59
|
+
// `effect()` even when called from a field initializer that isn't one on its own.
|
|
64
60
|
injector = inject(Injector);
|
|
65
61
|
connect() {
|
|
66
62
|
const result = signal(null);
|
|
@@ -10,12 +10,11 @@ export var DeviceMotionOrientation;
|
|
|
10
10
|
})(DeviceMotionOrientation || (DeviceMotionOrientation = {}));
|
|
11
11
|
export class DeviceMotionSensor extends DeviceSensor {
|
|
12
12
|
// Standard gravitational acceleration for Earth (m/s^2), read off the native module rather
|
|
13
|
-
// than hardcoded — mirrors upstream's dual exposure as
|
|
14
|
-
// standalone
|
|
13
|
+
// than hardcoded — mirrors upstream's dual exposure as an instance property and this
|
|
14
|
+
// standalone export.
|
|
15
15
|
gravity = exponentDeviceMotion.Gravity;
|
|
16
16
|
}
|
|
17
17
|
const DEVICE_MOTION_DID_UPDATE_EVENT_NAME = 'deviceMotionDidUpdate';
|
|
18
18
|
export const DeviceMotion = new DeviceMotionSensor(exponentDeviceMotion, DEVICE_MOTION_DID_UPDATE_EVENT_NAME);
|
|
19
|
-
//
|
|
20
|
-
// constant and not the full sensor singleton.
|
|
19
|
+
// Same value as `DeviceMotion.gravity`, for callers that only need the constant.
|
|
21
20
|
export const gravity = exponentDeviceMotion.Gravity;
|
package/build/core/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { Accelerometer, AccelerometerSensor, type IAccelerometerMeasurement, } from './accelerometer';
|
|
2
|
-
export { Barometer, BarometerSensor, type IBarometerMeasurement } from './barometer';
|
|
2
|
+
export { Barometer, BarometerSensor, type IBarometerMeasurement, } from './barometer';
|
|
3
3
|
export { DeviceMotion, DeviceMotionSensor, DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement, } from './device-motion';
|
|
4
|
-
export { Gyroscope, GyroscopeSensor, type IGyroscopeMeasurement } from './gyroscope';
|
|
5
|
-
export { LightSensor, LightSensorSensor, type ILightSensorMeasurement } from './light-sensor';
|
|
6
|
-
export { Magnetometer, MagnetometerSensor, type IMagnetometerMeasurement } from './magnetometer';
|
|
4
|
+
export { Gyroscope, GyroscopeSensor, type IGyroscopeMeasurement, } from './gyroscope';
|
|
5
|
+
export { LightSensor, LightSensorSensor, type ILightSensorMeasurement, } from './light-sensor';
|
|
6
|
+
export { Magnetometer, MagnetometerSensor, type IMagnetometerMeasurement, } from './magnetometer';
|
|
7
7
|
export { MagnetometerUncalibrated, MagnetometerUncalibratedSensor, type IMagnetometerUncalibratedMeasurement, } from './magnetometer-uncalibrated';
|
|
8
8
|
export { watchStepCount, getStepCountAsync, isAvailableAsync, getPermissionsAsync, requestPermissionsAsync, type IPedometerResult, type IPedometerUpdateCallback, } from './pedometer';
|
|
9
|
-
export { DeviceSensor, type IListener, type INativeSensorModule } from './device-sensor';
|
|
9
|
+
export { DeviceSensor, type IListener, type INativeSensorModule, } from './device-sensor';
|
|
10
10
|
export type { EventSubscription, PermissionExpiration, PermissionResponse, } from 'expo-modules-core';
|
|
11
11
|
export { PermissionStatus } from 'expo-modules-core';
|
package/build/core/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { Accelerometer, AccelerometerSensor, } from './accelerometer.js';
|
|
2
|
-
export { Barometer, BarometerSensor } from './barometer.js';
|
|
2
|
+
export { Barometer, BarometerSensor, } from './barometer.js';
|
|
3
3
|
export { DeviceMotion, DeviceMotionSensor, DeviceMotionOrientation, gravity, } from './device-motion.js';
|
|
4
|
-
export { Gyroscope, GyroscopeSensor } from './gyroscope.js';
|
|
5
|
-
export { LightSensor, LightSensorSensor } from './light-sensor.js';
|
|
6
|
-
export { Magnetometer, MagnetometerSensor } from './magnetometer.js';
|
|
4
|
+
export { Gyroscope, GyroscopeSensor, } from './gyroscope.js';
|
|
5
|
+
export { LightSensor, LightSensorSensor, } from './light-sensor.js';
|
|
6
|
+
export { Magnetometer, MagnetometerSensor, } from './magnetometer.js';
|
|
7
7
|
export { MagnetometerUncalibrated, MagnetometerUncalibratedSensor, } from './magnetometer-uncalibrated.js';
|
|
8
8
|
export { watchStepCount, getStepCountAsync, isAvailableAsync, getPermissionsAsync, requestPermissionsAsync, } from './pedometer.js';
|
|
9
|
-
export { DeviceSensor } from './device-sensor.js';
|
|
9
|
+
export { DeviceSensor, } from './device-sensor.js';
|
|
10
10
|
export { PermissionStatus } from 'expo-modules-core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// React lifecycle wiring over the framework-agnostic MagnetometerUncalibrated singleton
|
|
2
2
|
// (core/) — mirrors the lifecycle-bucket naming convention of adapters/react/src/hooks.
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { MagnetometerUncalibrated } from '../../../core/index.js';
|
|
4
|
+
import { MagnetometerUncalibrated, } from '../../../core/index.js';
|
|
5
5
|
export function useMagnetometerUncalibrated(updateIntervalMs) {
|
|
6
6
|
const [measurement, setMeasurement] = useState(null);
|
|
7
7
|
useEffect(() => {
|
package/build/react/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { IAccelerometerMeasurement } from '../core';
|
|
|
3
3
|
export { useBarometer } from './hooks/use-barometer';
|
|
4
4
|
export type { IBarometerMeasurement } from '../core';
|
|
5
5
|
export { useDeviceMotion } from './hooks/use-device-motion';
|
|
6
|
-
export { DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement } from '../core';
|
|
6
|
+
export { DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement, } from '../core';
|
|
7
7
|
export { useGyroscope } from './hooks/use-gyroscope';
|
|
8
8
|
export type { IGyroscopeMeasurement } from '../core';
|
|
9
9
|
export { useLightSensor } from './hooks/use-light-sensor';
|
package/build/react/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export { useAccelerometer } from './hooks/use-accelerometer/index.js';
|
|
6
6
|
export { useBarometer } from './hooks/use-barometer/index.js';
|
|
7
7
|
export { useDeviceMotion } from './hooks/use-device-motion/index.js';
|
|
8
|
-
export { DeviceMotionOrientation, gravity } from '../core/index.js';
|
|
8
|
+
export { DeviceMotionOrientation, gravity, } from '../core/index.js';
|
|
9
9
|
export { useGyroscope } from './hooks/use-gyroscope/index.js';
|
|
10
10
|
export { useLightSensor } from './hooks/use-light-sensor/index.js';
|
|
11
11
|
export { useMagnetometer } from './hooks/use-magnetometer/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createAccelerometer } from './primitives/create-accelerometer';
|
|
2
|
+
export { createBarometer } from './primitives/create-barometer';
|
|
3
|
+
export { createDeviceMotion } from './primitives/create-device-motion';
|
|
4
|
+
export { createGyroscope } from './primitives/create-gyroscope';
|
|
5
|
+
export { createLightSensor } from './primitives/create-light-sensor';
|
|
6
|
+
export { createMagnetometer } from './primitives/create-magnetometer';
|
|
7
|
+
export { createMagnetometerUncalibrated } from './primitives/create-magnetometer-uncalibrated';
|
|
8
|
+
export { createPedometer } from './primitives/create-pedometer';
|
|
9
|
+
export type { IUpdateIntervalMs } from './primitives/device-sensor-accessor';
|
|
10
|
+
export * from '../core';
|