@symbiote-native/sensors 0.1.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/LICENSE +21 -0
- package/README.md +138 -0
- package/build/angular/index.d.ts +16 -0
- package/build/angular/index.js +12 -0
- package/build/angular/services/accelerometer.service/index.d.ts +6 -0
- package/build/angular/services/accelerometer.service/index.js +81 -0
- package/build/angular/services/barometer.service/index.d.ts +6 -0
- package/build/angular/services/barometer.service/index.js +81 -0
- package/build/angular/services/device-motion.service/index.d.ts +6 -0
- package/build/angular/services/device-motion.service/index.js +81 -0
- package/build/angular/services/gyroscope.service/index.d.ts +6 -0
- package/build/angular/services/gyroscope.service/index.js +81 -0
- package/build/angular/services/light-sensor.service/index.d.ts +6 -0
- package/build/angular/services/light-sensor.service/index.js +81 -0
- package/build/angular/services/magnetometer-uncalibrated.service/index.d.ts +6 -0
- package/build/angular/services/magnetometer-uncalibrated.service/index.js +81 -0
- package/build/angular/services/magnetometer.service/index.d.ts +6 -0
- package/build/angular/services/magnetometer.service/index.js +81 -0
- package/build/angular/services/pedometer.service/index.d.ts +6 -0
- package/build/angular/services/pedometer.service/index.js +76 -0
- package/build/core/accelerometer.d.ts +10 -0
- package/build/core/accelerometer.js +6 -0
- package/build/core/barometer.d.ts +9 -0
- package/build/core/barometer.js +6 -0
- package/build/core/device-motion.d.ts +40 -0
- package/build/core/device-motion.js +21 -0
- package/build/core/device-sensor.d.ts +27 -0
- package/build/core/device-sensor.js +61 -0
- package/build/core/gyroscope.d.ts +10 -0
- package/build/core/gyroscope.js +6 -0
- package/build/core/index.d.ts +11 -0
- package/build/core/index.js +10 -0
- package/build/core/light-sensor.d.ts +8 -0
- package/build/core/light-sensor.js +6 -0
- package/build/core/magnetometer-uncalibrated.d.ts +10 -0
- package/build/core/magnetometer-uncalibrated.js +6 -0
- package/build/core/magnetometer.d.ts +10 -0
- package/build/core/magnetometer.js +6 -0
- package/build/core/native/exponent-accelerometer.d.ts +3 -0
- package/build/core/native/exponent-accelerometer.js +3 -0
- package/build/core/native/exponent-barometer.d.ts +3 -0
- package/build/core/native/exponent-barometer.js +3 -0
- package/build/core/native/exponent-device-motion.d.ts +7 -0
- package/build/core/native/exponent-device-motion.js +3 -0
- package/build/core/native/exponent-gyroscope.d.ts +3 -0
- package/build/core/native/exponent-gyroscope.js +3 -0
- package/build/core/native/exponent-light-sensor/index.android.d.ts +3 -0
- package/build/core/native/exponent-light-sensor/index.android.js +3 -0
- package/build/core/native/exponent-light-sensor/index.d.ts +1 -0
- package/build/core/native/exponent-light-sensor/index.ios.d.ts +3 -0
- package/build/core/native/exponent-light-sensor/index.ios.js +6 -0
- package/build/core/native/exponent-light-sensor/index.js +5 -0
- package/build/core/native/exponent-magnetometer-uncalibrated.d.ts +3 -0
- package/build/core/native/exponent-magnetometer-uncalibrated.js +3 -0
- package/build/core/native/exponent-magnetometer.d.ts +3 -0
- package/build/core/native/exponent-magnetometer.js +3 -0
- package/build/core/native/exponent-pedometer.d.ts +10 -0
- package/build/core/native/exponent-pedometer.js +3 -0
- package/build/core/pedometer.d.ts +10 -0
- package/build/core/pedometer.js +44 -0
- package/build/react/hooks/use-accelerometer/index.d.ts +2 -0
- package/build/react/hooks/use-accelerometer/index.js +17 -0
- package/build/react/hooks/use-barometer/index.d.ts +2 -0
- package/build/react/hooks/use-barometer/index.js +17 -0
- package/build/react/hooks/use-device-motion/index.d.ts +2 -0
- package/build/react/hooks/use-device-motion/index.js +17 -0
- package/build/react/hooks/use-gyroscope/index.d.ts +2 -0
- package/build/react/hooks/use-gyroscope/index.js +17 -0
- package/build/react/hooks/use-light-sensor/index.d.ts +2 -0
- package/build/react/hooks/use-light-sensor/index.js +17 -0
- package/build/react/hooks/use-magnetometer/index.d.ts +2 -0
- package/build/react/hooks/use-magnetometer/index.js +17 -0
- package/build/react/hooks/use-magnetometer-uncalibrated/index.d.ts +2 -0
- package/build/react/hooks/use-magnetometer-uncalibrated/index.js +17 -0
- package/build/react/hooks/use-pedometer/index.d.ts +2 -0
- package/build/react/hooks/use-pedometer/index.js +14 -0
- package/build/react/index.d.ts +16 -0
- package/build/react/index.js +14 -0
- package/build/vue/composables/use-accelerometer/index.d.ts +3 -0
- package/build/vue/composables/use-accelerometer/index.js +25 -0
- package/build/vue/composables/use-barometer/index.d.ts +3 -0
- package/build/vue/composables/use-barometer/index.js +25 -0
- package/build/vue/composables/use-device-motion/index.d.ts +3 -0
- package/build/vue/composables/use-device-motion/index.js +25 -0
- package/build/vue/composables/use-gyroscope/index.d.ts +3 -0
- package/build/vue/composables/use-gyroscope/index.js +25 -0
- package/build/vue/composables/use-light-sensor/index.d.ts +3 -0
- package/build/vue/composables/use-light-sensor/index.js +25 -0
- package/build/vue/composables/use-magnetometer/index.d.ts +3 -0
- package/build/vue/composables/use-magnetometer/index.js +25 -0
- package/build/vue/composables/use-magnetometer-uncalibrated/index.d.ts +3 -0
- package/build/vue/composables/use-magnetometer-uncalibrated/index.js +25 -0
- package/build/vue/composables/use-pedometer/index.d.ts +3 -0
- package/build/vue/composables/use-pedometer/index.js +20 -0
- package/build/vue/index.d.ts +16 -0
- package/build/vue/index.js +14 -0
- package/build-ngc/angular/index.d.ts +16 -0
- package/build-ngc/angular/index.js +13 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/accelerometer.service/index.d.ts +9 -0
- package/build-ngc/angular/services/accelerometer.service/index.js +40 -0
- package/build-ngc/angular/services/accelerometer.service/index.js.map +1 -0
- package/build-ngc/angular/services/barometer.service/index.d.ts +9 -0
- package/build-ngc/angular/services/barometer.service/index.js +40 -0
- package/build-ngc/angular/services/barometer.service/index.js.map +1 -0
- package/build-ngc/angular/services/device-motion.service/index.d.ts +9 -0
- package/build-ngc/angular/services/device-motion.service/index.js +40 -0
- package/build-ngc/angular/services/device-motion.service/index.js.map +1 -0
- package/build-ngc/angular/services/gyroscope.service/index.d.ts +9 -0
- package/build-ngc/angular/services/gyroscope.service/index.js +40 -0
- package/build-ngc/angular/services/gyroscope.service/index.js.map +1 -0
- package/build-ngc/angular/services/light-sensor.service/index.d.ts +9 -0
- package/build-ngc/angular/services/light-sensor.service/index.js +40 -0
- package/build-ngc/angular/services/light-sensor.service/index.js.map +1 -0
- package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.d.ts +9 -0
- package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js +40 -0
- package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js.map +1 -0
- package/build-ngc/angular/services/magnetometer.service/index.d.ts +9 -0
- package/build-ngc/angular/services/magnetometer.service/index.js +40 -0
- package/build-ngc/angular/services/magnetometer.service/index.js.map +1 -0
- package/build-ngc/angular/services/pedometer.service/index.d.ts +9 -0
- package/build-ngc/angular/services/pedometer.service/index.js +35 -0
- package/build-ngc/angular/services/pedometer.service/index.js.map +1 -0
- package/build-ngc/core/accelerometer.d.ts +10 -0
- package/build-ngc/core/accelerometer.js +7 -0
- package/build-ngc/core/accelerometer.js.map +1 -0
- package/build-ngc/core/barometer.d.ts +9 -0
- package/build-ngc/core/barometer.js +7 -0
- package/build-ngc/core/barometer.js.map +1 -0
- package/build-ngc/core/device-motion.d.ts +40 -0
- package/build-ngc/core/device-motion.js +22 -0
- package/build-ngc/core/device-motion.js.map +1 -0
- package/build-ngc/core/device-sensor.d.ts +27 -0
- package/build-ngc/core/device-sensor.js +62 -0
- package/build-ngc/core/device-sensor.js.map +1 -0
- package/build-ngc/core/gyroscope.d.ts +10 -0
- package/build-ngc/core/gyroscope.js +7 -0
- package/build-ngc/core/gyroscope.js.map +1 -0
- package/build-ngc/core/index.d.ts +11 -0
- package/build-ngc/core/index.js +11 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/light-sensor.d.ts +8 -0
- package/build-ngc/core/light-sensor.js +7 -0
- package/build-ngc/core/light-sensor.js.map +1 -0
- package/build-ngc/core/magnetometer-uncalibrated.d.ts +10 -0
- package/build-ngc/core/magnetometer-uncalibrated.js +7 -0
- package/build-ngc/core/magnetometer-uncalibrated.js.map +1 -0
- package/build-ngc/core/magnetometer.d.ts +10 -0
- package/build-ngc/core/magnetometer.js +7 -0
- package/build-ngc/core/magnetometer.js.map +1 -0
- package/build-ngc/core/native/exponent-accelerometer.d.ts +3 -0
- package/build-ngc/core/native/exponent-accelerometer.js +4 -0
- package/build-ngc/core/native/exponent-accelerometer.js.map +1 -0
- package/build-ngc/core/native/exponent-barometer.d.ts +3 -0
- package/build-ngc/core/native/exponent-barometer.js +4 -0
- package/build-ngc/core/native/exponent-barometer.js.map +1 -0
- package/build-ngc/core/native/exponent-device-motion.d.ts +7 -0
- package/build-ngc/core/native/exponent-device-motion.js +4 -0
- package/build-ngc/core/native/exponent-device-motion.js.map +1 -0
- package/build-ngc/core/native/exponent-gyroscope.d.ts +3 -0
- package/build-ngc/core/native/exponent-gyroscope.js +4 -0
- package/build-ngc/core/native/exponent-gyroscope.js.map +1 -0
- package/build-ngc/core/native/exponent-light-sensor/index.android.d.ts +3 -0
- package/build-ngc/core/native/exponent-light-sensor/index.android.js +4 -0
- package/build-ngc/core/native/exponent-light-sensor/index.android.js.map +1 -0
- package/build-ngc/core/native/exponent-light-sensor/index.d.ts +1 -0
- package/build-ngc/core/native/exponent-light-sensor/index.ios.d.ts +3 -0
- package/build-ngc/core/native/exponent-light-sensor/index.ios.js +7 -0
- package/build-ngc/core/native/exponent-light-sensor/index.ios.js.map +1 -0
- package/build-ngc/core/native/exponent-light-sensor/index.js +6 -0
- package/build-ngc/core/native/exponent-light-sensor/index.js.map +1 -0
- package/build-ngc/core/native/exponent-magnetometer-uncalibrated.d.ts +3 -0
- package/build-ngc/core/native/exponent-magnetometer-uncalibrated.js +4 -0
- package/build-ngc/core/native/exponent-magnetometer-uncalibrated.js.map +1 -0
- package/build-ngc/core/native/exponent-magnetometer.d.ts +3 -0
- package/build-ngc/core/native/exponent-magnetometer.js +4 -0
- package/build-ngc/core/native/exponent-magnetometer.js.map +1 -0
- package/build-ngc/core/native/exponent-pedometer.d.ts +10 -0
- package/build-ngc/core/native/exponent-pedometer.js +4 -0
- package/build-ngc/core/native/exponent-pedometer.js.map +1 -0
- package/build-ngc/core/pedometer.d.ts +10 -0
- package/build-ngc/core/pedometer.js +45 -0
- package/build-ngc/core/pedometer.js.map +1 -0
- package/package.json +106 -0
- package/src/angular/index.ts +26 -0
- package/src/angular/services/accelerometer.service/accelerometer.service.test.ts +118 -0
- package/src/angular/services/accelerometer.service/index.ts +39 -0
- package/src/angular/services/barometer.service/barometer.service.test.ts +122 -0
- package/src/angular/services/barometer.service/index.ts +39 -0
- package/src/angular/services/device-motion.service/device-motion.service.test.ts +125 -0
- package/src/angular/services/device-motion.service/index.ts +39 -0
- package/src/angular/services/gyroscope.service/gyroscope.service.test.ts +118 -0
- package/src/angular/services/gyroscope.service/index.ts +39 -0
- package/src/angular/services/light-sensor.service/index.ts +39 -0
- package/src/angular/services/light-sensor.service/light-sensor.service.test.ts +118 -0
- package/src/angular/services/magnetometer-uncalibrated.service/index.ts +39 -0
- package/src/angular/services/magnetometer-uncalibrated.service/magnetometer-uncalibrated.service.test.ts +123 -0
- package/src/angular/services/magnetometer.service/index.ts +39 -0
- package/src/angular/services/magnetometer.service/magnetometer.service.test.ts +118 -0
- package/src/angular/services/pedometer.service/index.ts +34 -0
- package/src/angular/services/pedometer.service/pedometer.service.test.ts +86 -0
- package/src/core/accelerometer.test.ts +49 -0
- package/src/core/accelerometer.ts +19 -0
- package/src/core/barometer.test.ts +46 -0
- package/src/core/barometer.ts +15 -0
- package/src/core/device-motion.test.ts +60 -0
- package/src/core/device-motion.ts +41 -0
- package/src/core/device-sensor.test.ts +76 -0
- package/src/core/device-sensor.ts +95 -0
- package/src/core/gyroscope.test.ts +46 -0
- package/src/core/gyroscope.ts +16 -0
- package/src/core/index.ts +37 -0
- package/src/core/light-sensor.test.ts +49 -0
- package/src/core/light-sensor.ts +18 -0
- package/src/core/magnetometer-uncalibrated.test.ts +49 -0
- package/src/core/magnetometer-uncalibrated.ts +20 -0
- package/src/core/magnetometer.test.ts +49 -0
- package/src/core/magnetometer.ts +19 -0
- package/src/core/native/exponent-accelerometer.ts +9 -0
- package/src/core/native/exponent-barometer.ts +9 -0
- package/src/core/native/exponent-device-motion.ts +15 -0
- package/src/core/native/exponent-gyroscope.ts +9 -0
- package/src/core/native/exponent-light-sensor/index.android.ts +9 -0
- package/src/core/native/exponent-light-sensor/index.ios.ts +12 -0
- package/src/core/native/exponent-light-sensor/index.ts +5 -0
- package/src/core/native/exponent-magnetometer-uncalibrated.ts +9 -0
- package/src/core/native/exponent-magnetometer.ts +9 -0
- package/src/core/native/exponent-pedometer.ts +17 -0
- package/src/core/pedometer.test.ts +118 -0
- package/src/core/pedometer.ts +62 -0
- package/src/react/hooks/use-accelerometer/index.ts +21 -0
- package/src/react/hooks/use-accelerometer/use-accelerometer.test.tsx +81 -0
- package/src/react/hooks/use-barometer/index.ts +21 -0
- package/src/react/hooks/use-barometer/use-barometer.test.tsx +83 -0
- package/src/react/hooks/use-device-motion/index.ts +21 -0
- package/src/react/hooks/use-device-motion/use-device-motion.test.tsx +88 -0
- package/src/react/hooks/use-gyroscope/index.ts +21 -0
- package/src/react/hooks/use-gyroscope/use-gyroscope.test.tsx +79 -0
- package/src/react/hooks/use-light-sensor/index.ts +21 -0
- package/src/react/hooks/use-light-sensor/use-light-sensor.test.tsx +79 -0
- package/src/react/hooks/use-magnetometer/index.ts +21 -0
- package/src/react/hooks/use-magnetometer/use-magnetometer.test.tsx +81 -0
- package/src/react/hooks/use-magnetometer-uncalibrated/index.ts +23 -0
- package/src/react/hooks/use-magnetometer-uncalibrated/use-magnetometer-uncalibrated.test.tsx +88 -0
- package/src/react/hooks/use-pedometer/index.ts +17 -0
- package/src/react/hooks/use-pedometer/use-pedometer.test.tsx +69 -0
- package/src/react/index.ts +29 -0
- package/src/vue/composables/use-accelerometer/index.ts +34 -0
- package/src/vue/composables/use-accelerometer/use-accelerometer.test.ts +96 -0
- package/src/vue/composables/use-barometer/index.ts +30 -0
- package/src/vue/composables/use-barometer/use-barometer.test.ts +100 -0
- package/src/vue/composables/use-device-motion/index.ts +30 -0
- package/src/vue/composables/use-device-motion/use-device-motion.test.ts +104 -0
- package/src/vue/composables/use-gyroscope/index.ts +30 -0
- package/src/vue/composables/use-gyroscope/use-gyroscope.test.ts +96 -0
- package/src/vue/composables/use-light-sensor/index.ts +30 -0
- package/src/vue/composables/use-light-sensor/use-light-sensor.test.ts +96 -0
- package/src/vue/composables/use-magnetometer/index.ts +30 -0
- package/src/vue/composables/use-magnetometer/use-magnetometer.test.ts +96 -0
- package/src/vue/composables/use-magnetometer-uncalibrated/index.ts +36 -0
- package/src/vue/composables/use-magnetometer-uncalibrated/use-magnetometer-uncalibrated.test.ts +103 -0
- package/src/vue/composables/use-pedometer/index.ts +25 -0
- package/src/vue/composables/use-pedometer/use-pedometer.test.ts +77 -0
- package/src/vue/index.ts +29 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// AccelerometerService is the Angular-only lifecycle half; the sensor singleton and event
|
|
2
|
+
// subscription plumbing all live in core, shared with React/Vue.
|
|
3
|
+
export { AccelerometerService } from './services/accelerometer.service';
|
|
4
|
+
export { BarometerService } from './services/barometer.service';
|
|
5
|
+
export { DeviceMotionService } from './services/device-motion.service';
|
|
6
|
+
export { DeviceMotionOrientation, gravity } from '../core';
|
|
7
|
+
export { GyroscopeService } from './services/gyroscope.service';
|
|
8
|
+
export { LightSensorService } from './services/light-sensor.service';
|
|
9
|
+
export { MagnetometerService } from './services/magnetometer.service';
|
|
10
|
+
export { MagnetometerUncalibratedService } from './services/magnetometer-uncalibrated.service';
|
|
11
|
+
export { PedometerService } from './services/pedometer.service';
|
|
12
|
+
export { watchStepCount, getStepCountAsync, isAvailableAsync, getPermissionsAsync, requestPermissionsAsync, } from '../core';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,iEAAiE;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAiC,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,8CAA8C,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,GAGxB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IAccelerometerMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class AccelerometerService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IAccelerometerMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccelerometerService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AccelerometerService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { Accelerometer } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useAccelerometer` hook and Vue's `useAccelerometer` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(AccelerometerService).connect();
|
|
10
|
+
// // template: {{ measurement()?.x }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class AccelerometerService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
Accelerometer.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = Accelerometer.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AccelerometerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AccelerometerService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AccelerometerService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/accelerometer.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAkC,MAAM,eAAe,CAAC;;AAE9E,2FAA2F;AAC3F,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,oBAAoB;IAC/B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAAmC,IAAI;wFAAC,CAAC;QAEnE,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,aAAa,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,oBAAoB;2GAApB,oBAAoB,cADP,MAAM;;2FACnB,oBAAoB;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IBarometerMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class BarometerService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IBarometerMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BarometerService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BarometerService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { Barometer } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useBarometer` hook and Vue's `useBarometer` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(BarometerService).connect();
|
|
10
|
+
// // template: {{ measurement()?.pressure }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class BarometerService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
Barometer.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = Barometer.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: BarometerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: BarometerService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: BarometerService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/barometer.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,SAAS,EAA8B,MAAM,eAAe,CAAC;;AAEtE,mFAAmF;AACnF,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,+DAA+D;AAC/D,+CAA+C;AAC/C,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,gBAAgB;IAC3B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAA+B,IAAI;wFAAC,CAAC;QAE/D,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YAChD,CAAC;YACD,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,gBAAgB;2GAAhB,gBAAgB,cADH,MAAM;;2FACnB,gBAAgB;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IDeviceMotionMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DeviceMotionService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IDeviceMotionMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceMotionService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceMotionService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { DeviceMotion } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useDeviceMotion` hook and Vue's `useDeviceMotion` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(DeviceMotionService).connect();
|
|
10
|
+
// // template: {{ measurement()?.rotation?.alpha }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class DeviceMotionService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
DeviceMotion.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = DeviceMotion.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DeviceMotionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DeviceMotionService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DeviceMotionService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/device-motion.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAiC,MAAM,eAAe,CAAC;;AAE5E,yFAAyF;AACzF,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,kEAAkE;AAClE,sDAAsD;AACtD,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,mBAAmB;IAC9B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAAkC,IAAI;wFAAC,CAAC;QAElE,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,YAAY,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACnD,CAAC;YACD,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,mBAAmB;2GAAnB,mBAAmB,cADN,MAAM;;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IGyroscopeMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class GyroscopeService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IGyroscopeMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GyroscopeService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GyroscopeService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { Gyroscope } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useGyroscope` hook and Vue's `useGyroscope` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(GyroscopeService).connect();
|
|
10
|
+
// // template: {{ measurement()?.x }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class GyroscopeService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
Gyroscope.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = Gyroscope.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: GyroscopeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: GyroscopeService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: GyroscopeService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/gyroscope.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,SAAS,EAA8B,MAAM,eAAe,CAAC;;AAEtE,mFAAmF;AACnF,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,+DAA+D;AAC/D,wCAAwC;AACxC,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,gBAAgB;IAC3B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAA+B,IAAI;wFAAC,CAAC;QAE/D,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YAChD,CAAC;YACD,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,gBAAgB;2GAAhB,gBAAgB,cADH,MAAM;;2FACnB,gBAAgB;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type ILightSensorMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class LightSensorService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<ILightSensorMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LightSensorService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LightSensorService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { LightSensor } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useLightSensor` hook and Vue's `useLightSensor` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(LightSensorService).connect();
|
|
10
|
+
// // template: {{ measurement()?.illuminance }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class LightSensorService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
LightSensor.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = LightSensor.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: LightSensorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: LightSensorService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: LightSensorService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/light-sensor.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAgC,MAAM,eAAe,CAAC;;AAE1E,uFAAuF;AACvF,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,iEAAiE;AACjE,kDAAkD;AAClD,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,kBAAkB;IAC7B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAAiC,IAAI;wFAAC,CAAC;QAEjE,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YAClD,CAAC;YACD,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,kBAAkB;2GAAlB,kBAAkB,cADL,MAAM;;2FACnB,kBAAkB;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IMagnetometerUncalibratedMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class MagnetometerUncalibratedService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IMagnetometerUncalibratedMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MagnetometerUncalibratedService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MagnetometerUncalibratedService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { MagnetometerUncalibrated } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useMagnetometerUncalibrated` hook and Vue's
|
|
5
|
+
// `useMagnetometerUncalibrated` composable. Angular has no per-instance hook — state and
|
|
6
|
+
// lifecycle live in DI instead, so `connect()` stands in for the hook's role: call it ONCE
|
|
7
|
+
// (typically from a component's field initializer, inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(MagnetometerUncalibratedService).connect();
|
|
10
|
+
// // template: {{ measurement()?.x }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class MagnetometerUncalibratedService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
MagnetometerUncalibrated.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = MagnetometerUncalibrated.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerUncalibratedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerUncalibratedService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerUncalibratedService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/magnetometer-uncalibrated.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAA6C,MAAM,eAAe,CAAC;;AAEpG,uEAAuE;AACvE,yFAAyF;AACzF,2FAA2F;AAC3F,iFAAiF;AACjF,EAAE;AACF,8EAA8E;AAC9E,wCAAwC;AACxC,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,+BAA+B;IAC1C,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAA8C,IAAI;wFAAC,CAAC;QAE9E,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,wBAAwB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YAC/D,CAAC;YACD,MAAM,YAAY,GAAG,wBAAwB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACzF,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,+BAA+B;2GAA/B,+BAA+B,cADlB,MAAM;;2FACnB,+BAA+B;kBAD3C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IMagnetometerMeasurement } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class MagnetometerService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(updateIntervalMs?: number): Signal<IMagnetometerMeasurement | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MagnetometerService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MagnetometerService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { Magnetometer } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `useMagnetometer` hook and Vue's `useMagnetometer` composable.
|
|
5
|
+
// Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
|
|
6
|
+
// stands in for the hook's role: call it ONCE (typically from a component's field initializer,
|
|
7
|
+
// inside an injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly measurement = inject(MagnetometerService).connect();
|
|
10
|
+
// // template: {{ measurement()?.x }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
|
|
13
|
+
// subscription doesn't depend on anything the caller's own signals could change between
|
|
14
|
+
// renders — so a single effect() that subscribes once and cleans up once is enough; no
|
|
15
|
+
// `updateConfig`-style effect that re-runs on every read is needed here.
|
|
16
|
+
export class MagnetometerService {
|
|
17
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's
|
|
18
|
+
// own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
19
|
+
// code that is not, on its own, an active injection context — mirrors HideAnimationService.
|
|
20
|
+
injector = inject(Injector);
|
|
21
|
+
connect(updateIntervalMs) {
|
|
22
|
+
const measurement = signal(null, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "measurement" }] : /* istanbul ignore next */ []));
|
|
24
|
+
effect(onCleanup => {
|
|
25
|
+
if (updateIntervalMs !== undefined) {
|
|
26
|
+
Magnetometer.setUpdateInterval(updateIntervalMs);
|
|
27
|
+
}
|
|
28
|
+
const subscription = Magnetometer.addListener(next => measurement.set(next));
|
|
29
|
+
onCleanup(() => subscription.remove());
|
|
30
|
+
}, { injector: this.injector });
|
|
31
|
+
return measurement.asReadonly();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerService, providedIn: 'root' });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MagnetometerService, decorators: [{
|
|
37
|
+
type: Injectable,
|
|
38
|
+
args: [{ providedIn: 'root' }]
|
|
39
|
+
}] });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/magnetometer.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAiC,MAAM,eAAe,CAAC;;AAE5E,yFAAyF;AACzF,4FAA4F;AAC5F,+FAA+F;AAC/F,gCAAgC;AAChC,EAAE;AACF,kEAAkE;AAClE,wCAAwC;AACxC,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,uFAAuF;AACvF,yEAAyE;AAEzE,MAAM,OAAO,mBAAmB;IAC9B,0FAA0F;IAC1F,gGAAgG;IAChG,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO,CAAC,gBAAyB;QAC/B,MAAM,WAAW,GAAG,MAAM,CAAkC,IAAI;wFAAC,CAAC;QAElE,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,YAAY,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACnD,CAAC;YACD,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7E,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;uGArBU,mBAAmB;2GAAnB,mBAAmB,cADN,MAAM;;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import { type IPedometerResult } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class PedometerService {
|
|
5
|
+
private readonly injector;
|
|
6
|
+
connect(): Signal<IPedometerResult | null>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PedometerService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PedometerService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { effect, inject, Injectable, Injector, signal } from '@angular/core';
|
|
2
|
+
import { watchStepCount } from '../../../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
// Angular twin of React's `usePedometer` hook and Vue's `usePedometer` composable. Angular has
|
|
5
|
+
// no per-instance hook — state and lifecycle live in DI instead, so `connect()` stands in for
|
|
6
|
+
// the hook's role: call it ONCE (typically from a component's field initializer, inside an
|
|
7
|
+
// injection context).
|
|
8
|
+
//
|
|
9
|
+
// readonly result = inject(PedometerService).connect();
|
|
10
|
+
// // template: {{ result()?.steps }}
|
|
11
|
+
//
|
|
12
|
+
// Unlike AccelerometerService.connect(), there is no updateIntervalMs to apply — Pedometer has
|
|
13
|
+
// no setUpdateInterval — so a single effect() that subscribes once and cleans up once is enough.
|
|
14
|
+
export class PedometerService {
|
|
15
|
+
// Captured in the constructor (itself always run inside an injection context by Angular's own
|
|
16
|
+
// DI) so `connect()` can create an `effect()` even when called from plain field-initializer
|
|
17
|
+
// code that is not, on its own, an active injection context — mirrors AccelerometerService.
|
|
18
|
+
injector = inject(Injector);
|
|
19
|
+
connect() {
|
|
20
|
+
const result = signal(null, /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "result" }] : /* istanbul ignore next */ []));
|
|
22
|
+
effect(onCleanup => {
|
|
23
|
+
const subscription = watchStepCount(next => result.set(next));
|
|
24
|
+
onCleanup(() => subscription.remove());
|
|
25
|
+
}, { injector: this.injector });
|
|
26
|
+
return result.asReadonly();
|
|
27
|
+
}
|
|
28
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PedometerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
29
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PedometerService, providedIn: 'root' });
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PedometerService, decorators: [{
|
|
32
|
+
type: Injectable,
|
|
33
|
+
args: [{ providedIn: 'root' }]
|
|
34
|
+
}] });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/angular/services/pedometer.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAyB,MAAM,eAAe,CAAC;;AAEtE,+FAA+F;AAC/F,8FAA8F;AAC9F,2FAA2F;AAC3F,sBAAsB;AACtB,EAAE;AACF,0DAA0D;AAC1D,uCAAuC;AACvC,EAAE;AACF,+FAA+F;AAC/F,iGAAiG;AAEjG,MAAM,OAAO,gBAAgB;IAC3B,8FAA8F;IAC9F,4FAA4F;IAC5F,4FAA4F;IAC3E,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,OAAO;QACL,MAAM,MAAM,GAAG,MAAM,CAA0B,IAAI;mFAAC,CAAC;QAErD,MAAM,CACJ,SAAS,CAAC,EAAE;YACV,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9D,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACzC,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAC5B,CAAC;QAEF,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;uGAlBU,gBAAgB;2GAAhB,gBAAgB,cADH,MAAM;;2FACnB,gBAAgB;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
export type IAccelerometerMeasurement = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
};
|
|
8
|
+
export declare class AccelerometerSensor extends DeviceSensor<IAccelerometerMeasurement> {
|
|
9
|
+
}
|
|
10
|
+
export declare const Accelerometer: AccelerometerSensor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
import { exponentAccelerometer } from './native/exponent-accelerometer';
|
|
3
|
+
export class AccelerometerSensor extends DeviceSensor {
|
|
4
|
+
}
|
|
5
|
+
const ACCELEROMETER_DID_UPDATE_EVENT_NAME = 'accelerometerDidUpdate';
|
|
6
|
+
export const Accelerometer = new AccelerometerSensor(exponentAccelerometer, ACCELEROMETER_DID_UPDATE_EVENT_NAME);
|
|
7
|
+
//# sourceMappingURL=accelerometer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accelerometer.js","sourceRoot":"","sources":["../../src/core/accelerometer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAUxE,MAAM,OAAO,mBAAoB,SAAQ,YAAuC;CAAG;AAEnF,MAAM,mCAAmC,GAAG,wBAAwB,CAAC;AAErE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,mBAAmB,CAClD,qBAAqB,EACrB,mCAAmC,CACpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
export type IBarometerMeasurement = {
|
|
3
|
+
pressure: number;
|
|
4
|
+
relativeAltitude?: number;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class BarometerSensor extends DeviceSensor<IBarometerMeasurement> {
|
|
8
|
+
}
|
|
9
|
+
export declare const Barometer: BarometerSensor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
import { exponentBarometer } from './native/exponent-barometer';
|
|
3
|
+
export class BarometerSensor extends DeviceSensor {
|
|
4
|
+
}
|
|
5
|
+
const BAROMETER_DID_UPDATE_EVENT_NAME = 'barometerDidUpdate';
|
|
6
|
+
export const Barometer = new BarometerSensor(exponentBarometer, BAROMETER_DID_UPDATE_EVENT_NAME);
|
|
7
|
+
//# sourceMappingURL=barometer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barometer.js","sourceRoot":"","sources":["../../src/core/barometer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAShE,MAAM,OAAO,eAAgB,SAAQ,YAAmC;CAAG;AAE3E,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,iBAAiB,EAAE,+BAA+B,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
export type IDeviceMotionMeasurement = {
|
|
3
|
+
acceleration: null | {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
};
|
|
9
|
+
accelerationIncludingGravity: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
};
|
|
15
|
+
rotation: {
|
|
16
|
+
alpha: number;
|
|
17
|
+
beta: number;
|
|
18
|
+
gamma: number;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
};
|
|
21
|
+
rotationRate: null | {
|
|
22
|
+
alpha: number;
|
|
23
|
+
beta: number;
|
|
24
|
+
gamma: number;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
};
|
|
27
|
+
interval: number;
|
|
28
|
+
orientation: DeviceMotionOrientation;
|
|
29
|
+
};
|
|
30
|
+
export declare enum DeviceMotionOrientation {
|
|
31
|
+
Portrait = 0,
|
|
32
|
+
RightLandscape = 90,
|
|
33
|
+
UpsideDown = 180,
|
|
34
|
+
LeftLandscape = -90
|
|
35
|
+
}
|
|
36
|
+
export declare class DeviceMotionSensor extends DeviceSensor<IDeviceMotionMeasurement> {
|
|
37
|
+
readonly gravity: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const DeviceMotion: DeviceMotionSensor;
|
|
40
|
+
export declare const gravity: number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeviceSensor } from './device-sensor';
|
|
2
|
+
import { exponentDeviceMotion } from './native/exponent-device-motion';
|
|
3
|
+
// Device orientation based on screen rotation.
|
|
4
|
+
export var DeviceMotionOrientation;
|
|
5
|
+
(function (DeviceMotionOrientation) {
|
|
6
|
+
DeviceMotionOrientation[DeviceMotionOrientation["Portrait"] = 0] = "Portrait";
|
|
7
|
+
DeviceMotionOrientation[DeviceMotionOrientation["RightLandscape"] = 90] = "RightLandscape";
|
|
8
|
+
DeviceMotionOrientation[DeviceMotionOrientation["UpsideDown"] = 180] = "UpsideDown";
|
|
9
|
+
DeviceMotionOrientation[DeviceMotionOrientation["LeftLandscape"] = -90] = "LeftLandscape";
|
|
10
|
+
})(DeviceMotionOrientation || (DeviceMotionOrientation = {}));
|
|
11
|
+
export class DeviceMotionSensor extends DeviceSensor {
|
|
12
|
+
// Standard gravitational acceleration for Earth (m/s^2), read off the native module rather
|
|
13
|
+
// than hardcoded — mirrors upstream's dual exposure as both an instance property and the
|
|
14
|
+
// standalone `gravity` export below.
|
|
15
|
+
gravity = exponentDeviceMotion.Gravity;
|
|
16
|
+
}
|
|
17
|
+
const DEVICE_MOTION_DID_UPDATE_EVENT_NAME = 'deviceMotionDidUpdate';
|
|
18
|
+
export const DeviceMotion = new DeviceMotionSensor(exponentDeviceMotion, DEVICE_MOTION_DID_UPDATE_EVENT_NAME);
|
|
19
|
+
// Standalone export mirroring the instance property above, for callers that only need the
|
|
20
|
+
// constant and not the full sensor singleton.
|
|
21
|
+
export const gravity = exponentDeviceMotion.Gravity;
|
|
22
|
+
//# sourceMappingURL=device-motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-motion.js","sourceRoot":"","sources":["../../src/core/device-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAevE,+CAA+C;AAC/C,MAAM,CAAN,IAAY,uBAKX;AALD,WAAY,uBAAuB;IACjC,6EAAY,CAAA;IACZ,0FAAmB,CAAA;IACnB,mFAAgB,CAAA;IAChB,yFAAmB,CAAA;AACrB,CAAC,EALW,uBAAuB,KAAvB,uBAAuB,QAKlC;AAED,MAAM,OAAO,kBAAmB,SAAQ,YAAsC;IAC5E,2FAA2F;IAC3F,yFAAyF;IACzF,qCAAqC;IAC5B,OAAO,GAAW,oBAAoB,CAAC,OAAO,CAAC;CACzD;AAED,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAChD,oBAAoB,EACpB,mCAAmC,CACpC,CAAC;AAEF,0FAA0F;AAC1F,8CAA8C;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAW,oBAAoB,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PermissionStatus, type EventSubscription, type PermissionExpiration, type PermissionResponse } from 'expo-modules-core';
|
|
2
|
+
export type IListener<Measurement> = (measurement: Measurement) => void;
|
|
3
|
+
export type INativeSensorModule<Measurement> = {
|
|
4
|
+
addListener(eventName: string, listener: IListener<Measurement>): EventSubscription;
|
|
5
|
+
listenerCount(eventName: string): number;
|
|
6
|
+
removeAllListeners(eventName: string): void;
|
|
7
|
+
setUpdateInterval?(intervalMs: number): void;
|
|
8
|
+
isAvailableAsync?(): Promise<boolean>;
|
|
9
|
+
getPermissionsAsync?(): Promise<PermissionResponse>;
|
|
10
|
+
requestPermissionsAsync?(): Promise<PermissionResponse>;
|
|
11
|
+
};
|
|
12
|
+
export declare class DeviceSensor<Measurement> {
|
|
13
|
+
readonly nativeModule: INativeSensorModule<Measurement>;
|
|
14
|
+
readonly nativeEventName: string;
|
|
15
|
+
constructor(nativeModule: INativeSensorModule<Measurement>, nativeEventName: string);
|
|
16
|
+
addListener(listener: IListener<Measurement>): EventSubscription;
|
|
17
|
+
hasListeners(): boolean;
|
|
18
|
+
getListenerCount(): number;
|
|
19
|
+
removeAllListeners(): void;
|
|
20
|
+
removeSubscription(subscription: EventSubscription): void;
|
|
21
|
+
setUpdateInterval(intervalMs: number): void;
|
|
22
|
+
isAvailableAsync(): Promise<boolean>;
|
|
23
|
+
getPermissionsAsync(): Promise<PermissionResponse>;
|
|
24
|
+
requestPermissionsAsync(): Promise<PermissionResponse>;
|
|
25
|
+
}
|
|
26
|
+
export { PermissionStatus };
|
|
27
|
+
export type { EventSubscription, PermissionExpiration, PermissionResponse };
|