Since

0.1

Accelerometer is an interface for accessing accelerometer data on the device.

Example

import Accelerometer from '@smartface/native/device/accelerometer';
Accelerometer.start();
Accelerometer.onAccelerate = function(e) {
console.log("x: " + e.x + " y : " + e.y + " z : " + e.z);
if (event.z > 9) {
Accelerometer.stop();
}
};

Hierarchy

Properties

_nativeObject: any
start: (() => void)

Type declaration

    • (): void
    • Starts capturing accelerometer values.

      Method

      start

      Android

      Ios

      Since

      0.1

      Returns void

stop: (() => void)

Type declaration

    • (): void
    • Stops capturing.

      Method

      stop

      Android

      Ios

      Since

      0.1

      Returns void

ios: Partial<{ accelerometerUpdateInterval: number }>

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get android(): TProps["android"]
  • Returns TProps["android"]

Methods

  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Parameters

    • Optional params: Partial<Record<string, any>>

    Returns any

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Parameters

    • props: Partial<{ [key: string]: any }>

    Returns void

  • Parameters

    • props: Partial<{ [key: string]: any }>

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((e: { x: number; y: number; z: number }) => void)
        • (e: { x: number; y: number; z: number }): void
        • Parameters

          • e: { x: number; y: number; z: number }
            • x: number
            • y: number
            • z: number

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((e: { x: number; y: number; z: number }) => void)
        • (e: { x: number; y: number; z: number }): void
        • Parameters

          • e: { x: number; y: number; z: number }
            • x: number
            • y: number
            • z: number

          Returns void

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Parameters

    • eventName: "accelerate"
    • e: { x: number; y: number; z: number }
      • x: number
      • y: number
      • z: number

    Returns void

  • Parameters

    • eventName: "accelerate"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((e: { x: number; y: number; z: number }) => void)
        • (e: { x: number; y: number; z: number }): void
        • Parameters

          • e: { x: number; y: number; z: number }
            • x: number
            • y: number
            • z: number

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((e: { x: number; y: number; z: number }) => void)
        • (e: { x: number; y: number; z: number }): void
        • Parameters

          • e: { x: number; y: number; z: number }
            • x: number
            • y: number
            • z: number

          Returns void

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((e: { x: number; y: number; z: number }) => void)
        • (e: { x: number; y: number; z: number }): void
        • Parameters

          • e: { x: number; y: number; z: number }
            • x: number
            • y: number
            • z: number

          Returns void

    Returns void

  • Parameters

    • eventName: "accelerate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

Events

onAccelerate: ((e: { x: number; y: number; z: number }) => void)

Type declaration

    • (e: { x: number; y: number; z: number }): void
    • Callback to capture accelerometer events.

      Since

      0.1 onAccelerate

      Android

      Ios

      Deprecated

      Example

      import AcceleroMeter from '@smartface/native/device/accelerometer';

      AcceleroMeter.on(AcceleroMeter.Events.Accelerate, (params) => {
      console.info('onAccelerate', params);
      });

      Parameters

      • e: { x: number; y: number; z: number }
        • x: number
        • y: number
        • z: number

      Returns void

Generated using TypeDoc