From 83a5b49a6d41dc59d8785ff2bc470f632509263b Mon Sep 17 00:00:00 2001 From: li-yaoyao777 Date: Mon, 11 Jul 2022 09:28:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=AF=B9=E9=BD=90=EF=BC=8C?= =?UTF-8?q?=E5=9B=9B=E5=AD=97=E7=AC=A6=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-yaoyao777 --- .../main/extend/systemplugin/napi/ohos_sensor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_sensor.js b/runtime/main/extend/systemplugin/napi/ohos_sensor.js index 66b6f6d0..711782c2 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_sensor.js +++ b/runtime/main/extend/systemplugin/napi/ohos_sensor.js @@ -178,8 +178,8 @@ export function mockSensor() { on: function (...args) { console.warn('sensor.on interface mocked in the Previewer. How this interface works on the' + 'Previewer may be different from that on a real device.') - const len = args.length; - const callback = typeof args[len - 1] === 'function' ? args[len - 1] : args[len - 2]; + const len = args.length; + const callback = typeof args[len - 1] === 'function' ? args[len - 1] : args[len - 2]; if (args[0] == 1) { callback.call(this, AccelerometerResponse); } else if (args[0] == 2) { @@ -227,7 +227,7 @@ export function mockSensor() { once: function (...args) { console.warn('sensor.once interface mocked in the Previewer. How this interface works on the' + 'Previewer may be different from that on a real device.') - const len = args.length + const len = args.length if (args[0] == 1) { args[len - 1].call(this, AccelerometerResponse); } else if (args[0] == 2) { @@ -337,7 +337,7 @@ export function mockSensor() { args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock); } else { return new Promise((resolve, reject) => { - resolve(RotationMatrixResponse); + resolve(RotationMatrixResponse); }); } } else if (len == 3) { @@ -358,10 +358,10 @@ export function mockSensor() { } }, createQuaternion: function (...args) { - console.warn('sensor.createQuaternion interface mocked in the Previewer. How this interface works on the' + console.warn('sensor.createQuaternion interface mocked in the Previewer. How this interface works on the' + 'Previewer may be different from that on a real device.') - const len = args.length - if (typeof args[len - 1] === 'function') { + const len = args.length + if (typeof args[len - 1] === 'function') { args[len - 1].call(this, paramMock.businessErrorMock, [paramMock.paraNumberMock]); } else { return new Promise((resolve, reject) => {