我从https://github.com/NeoLSN/cordova-plugin-gyroscope实现了陀螺仪,然后,当我将它作为 Angular 导入时,我得到了
找不到名称“构造函数”。以及有关以下从https://ionicframework.com/docs/native/gyroscope导入的其他错误。
有人有完整版吗?
import { Gyroscope, GyroscopeOrientation, GyroscopeOptions } from '@ionic-native/gyroscope/ngx';
constructor(private gyroscope: Gyroscope) { }
...
let options: GyroscopeOptions = {
frequency: 1000
}
this.gyroscope.getCurrent(options)
.then((orientation: GyroscopeOrientation) => {
console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
})
.catch()
this.gyroscope.watch()
.subscribe((orientation: GyroscopeOrientation) => {
console.log(orientation.x, orientation.y, orientation.z, orientation.timestamp);
});