0.3.4 • Published 6 months ago

@types/motion-sensors-polyfill v0.3.4

Weekly downloads
24
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/motion-sensors-polyfill

Summary

This package contains type definitions for motion-sensors-polyfill (https://github.com/kenchris/lit-element).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/motion-sensors-polyfill.

index.d.ts

// Type definitions for motion-sensors-polyfill 0.3
// Project: https://github.com/kenchris/lit-element
// Definitions by: Kevin Wylder <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

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 {
    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: Thu, 08 Jul 2021 18:50:59 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Kevin Wylder.

0.3.2

8 months ago

0.3.4

6 months ago

0.3.3

7 months ago

0.3.1

3 years ago

0.3.0

4 years ago