# @types/motion-sensors-polyfill

> TypeScript definitions for motion-sensors-polyfill

Latest version **0.3.5** (published 2024-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/motion-sensors-polyfill
pnpm add @types/motion-sensors-polyfill
yarn add @types/motion-sensors-polyfill
bun add @types/motion-sensors-polyfill
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.5 |
| Published | 2024-07-16 |
| First published | 2020-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51438 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/motion-sensors-polyfill
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/motion-sensors-polyfill
- npm.io page: https://npm.io/package/@types/motion-sensors-polyfill

## Recent versions

- 0.3.5 (latest) — 2024-07-16
- 0.3.4 (ts4.7) — 2023-11-07
- 0.3.1 (ts4.2) — 2021-07-08
- 0.3.0 (ts3.2) — 2020-05-19
- 0.3.3 — 2023-10-18
- 0.3.2 — 2023-09-27

## README

# Installation
> `npm install --save @types/motion-sensors-polyfill`

# Summary
This package contains type definitions for motion-sensors-polyfill (https://github.com/kenchris/sensor-polyfills).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/motion-sensors-polyfill.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/motion-sensors-polyfill/index.d.ts)
````ts
export {};

type EventHandler = (event: Event) => void;

export class Sensor extends EventTarget {
    readonly activated: boolean;
    readonly hasReading: boolean;
    readonly timestamp?: DOMHighResTimeStamp | undefined;
    start(): void;
    stop(): void;
    onreading: EventHandler;
    onactivate: EventHandler;
    onerror: EventHandler;
}

interface SensorOptions {
    frequency?: number | undefined;
}

type AccelerometerLocalCoordinateSystem = "device" | "screen";

interface AccelerometerSensorOptions extends SensorOptions {
    referenceFrame?: AccelerometerLocalCoordinateSystem | undefined; // defaults to "device". IDK how to type this
}

export class Accelerometer extends Sensor {
    constructor(options?: AccelerometerSensorOptions);
    readonly x: number;
    readonly y: number;
    readonly z: number;
}

export class LinearAccelerationSensor extends Accelerometer {
    constructor(options?: AccelerometerSensorOptions);
}

export class GravitySensor extends Accelerometer {
    constructor(options?: AccelerometerSensorOptions);
}

interface GyroscopeSensorOptions extends SensorOptions {
    referenceFrame?: GyroscopeLocalCoordinateSystem | undefined; // defauts to "device"
}

type GyroscopeLocalCoordinateSystem = "device" | "screen";

export class Gyroscope extends Sensor {
    constructor(options?: GyroscopeSensorOptions);
    readonly x: number;
    readonly y: number;
    readonly z: number;
}

type OrientationSensorLocalCoordinateSystem = "device" | "screen";

interface OrientationSensorOptions extends SensorOptions {
    referenceFrame?: OrientationSensorLocalCoordinateSystem | undefined; // defaults to "device"
}

type RotationMatrixType = Float32Array | Float64Array | DOMMatrix;

export class OrientationSensor extends Sensor {
    readonly quaternion: [number, number, number, number];
    populateMatrix(matrix: RotationMatrixType): void;
}

export class RelativeOrientationSensor extends OrientationSensor {
    constructor(options?: OrientationSensorOptions);
}

export class AbsoluteOrientationSensor extends OrientationSensor {
    constructor(options?: OrientationSensorOptions);
}

````

### Additional Details
 * Last updated: Tue, 16 Jul 2024 20:07:33 GMT
 * Dependencies: none

# Credits
These definitions were written by [Kevin Wylder](https://github.com/me).

---
_Source: https://npm.io/package/@types/motion-sensors-polyfill · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
