2.0.4 • Published 6 months ago

@types/gyronorm v2.0.4

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

Installation

npm install --save @types/gyronorm

Summary

This package contains type definitions for gyronorm (https://github.com/dorukeker/gyronorm.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gyronorm.

index.d.ts

// Type definitions for gyronorm 2.0
// Project: https://github.com/dorukeker/gyronorm.js
// Definitions by: Evan Shortiss <https://github.com/evanshortiss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export interface MotionAndOrientationPayload {
    do: {
    alpha: number;
    beta: number;
    gamma: number;
    absolute: number;
    };

    dm: {
    x: number;
    y: number;
    z: number;

    gx: number;
    gy: number;
    gz: number;

    alpha: number;
    beta: number;
    gamma: number;
    };
}

export interface Options {
    /**
     * How often GyroNorm returns data (in milliseconds)
     */
    frequency?: number | undefined;

    /**
     * If the gravity related values to be normalized
     */
    gravityNormalized?: boolean | undefined;

    /**
     * Can be GyroNorm.GAME or GyroNorm.WORLD. gn.GAME returns
     * orientation values with respect to the head direction of the device.
     * gn.WORLD returns the orientation values with respect to the actual
     * north direction of the world.
     */
    orientationBase?: string | undefined;

    /**
     * How many digits after the decimal point will there be in the return values
     */
    decimalCount?: number | undefined;

    /**
     * Function to be called to log messages from gyronorm.js
     */
    logger?: LogListener | undefined;

    /**
     * If set to true it will return screen adjusted values
     */
    screenAdjusted?: boolean | undefined;
}

export interface LoggerData {
    code: number;
    message: string;
}

export type LogListener = (data: LoggerData) => void;

export class GyroNorm {
    constructor()

    static GAME: string;
    static WORLD: string;

    static DEVICE_ORIENTATION: string;
    static ACCELERATION: string;
    static ACCELERATION_INCLUDING_GRAVITY: string;
    static ROTATION_RATE: string;

    init(options: Options): Promise<void>;

    start(callback: (data: MotionAndOrientationPayload) => void): void;

    startLogging(listener: LogListener): void;
    stopLogging(): void;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 14:22:37 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Evan Shortiss.

2.0.3

7 months ago

2.0.2

8 months ago

2.0.4

6 months ago

2.0.1

3 years ago

2.0.0

5 years ago