universal-accelerometer
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

universal-accelerometer npm

Accelerometer monitor and cancel.

Support

miniApp wechatMiniprogram

Install

$ npm install universal-accelerometer --save

Methods

onChange(callback): void

Monitoring acceleration data, the callback interval is 500ms, the interface calls will automatically start listening, can use offChange() to stop listening.

Parameters

Property Type Description Support
callback Function The callback function miniApp wechatMiniprogram

offChange(): void

Stop listening for acceleration data.

Example

import Accelerometer from 'universal-accelerometer';
 
Accelerometer.onChange(res => {
  console.log(res.x);
  console.log(res.y);
  console.log(res.z);
});
 
Accelerometer.offChange();

/universal-accelerometer/

    Package Sidebar

    Install

    npm i universal-accelerometer

    Weekly Downloads

    1

    Version

    1.0.1

    License

    BSD-3-Clause

    Unpacked Size

    7.34 kB

    Total Files

    26

    Last publish

    Collaborators

    • rax-publisher