mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
!507 Fix var is used instead of let or const inspection
Merge pull request !507 from butter/master
This commit is contained in:
commit
a6bffde2ff
@ -48,7 +48,7 @@ function registerDeviceListCallback() {
|
||||
if (numDevices === 0) {
|
||||
if (discoveredDevices > 0) {
|
||||
prompt.showToast({
|
||||
message: "registerDeviceListCallback dicovered " + discoveredDevices + " devices, need to authenticate"
|
||||
message: "registerDeviceListCallback discovered " + discoveredDevices + " devices, need to authenticate"
|
||||
});
|
||||
} else {
|
||||
prompt.showToast({
|
||||
|
@ -18,10 +18,10 @@ import RemoteDeviceModel from '../../../model/RemoteDeviceModel.js';
|
||||
import rpc from "@ohos.rpc";
|
||||
import prompt from '@system.prompt';
|
||||
|
||||
var mRemote;
|
||||
var DEVICE_LIST_LOCALHOST;
|
||||
var connectedAbility;
|
||||
var localDeviceId = "";
|
||||
let mRemote;
|
||||
let DEVICE_LIST_LOCALHOST;
|
||||
let connectedAbility;
|
||||
const localDeviceId = "";
|
||||
|
||||
export default {
|
||||
data: {
|
||||
@ -43,16 +43,16 @@ export default {
|
||||
let self = this;
|
||||
this.remoteDeviceModel.registerDeviceListCallback(() => {
|
||||
console.info('registerDeviceListCallback, callback entered');
|
||||
var list = [];
|
||||
const list = [];
|
||||
list[0] = DEVICE_LIST_LOCALHOST;
|
||||
var deviceList;
|
||||
let deviceList;
|
||||
if (self.remoteDeviceModel.discoverList.length > 0) {
|
||||
deviceList = self.remoteDeviceModel.discoverList;
|
||||
} else {
|
||||
deviceList = self.remoteDeviceModel.deviceList;
|
||||
}
|
||||
console.info('on remote device updated, count=' + deviceList.length);
|
||||
for (var i = 0; i < deviceList.length; i++) {
|
||||
for (let i = 0; i < deviceList.length; i++) {
|
||||
console.info('device ' + i + '/' + deviceList.length + ' deviceId='
|
||||
+ deviceList[i].deviceId + ' deviceName=' + deviceList[i].deviceName + ' deviceType='
|
||||
+ deviceList[i].deviceType);
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
onStartLocalAbilityClick() {
|
||||
console.info('[dmsDemo] onStartLocalAbilityClick begin');
|
||||
console.info('[dmsDemo] onStartLocalAbilityClick deviceId is ' + localDeviceId);
|
||||
var wantValue = {
|
||||
const wantValue = {
|
||||
bundleName: 'ohos.dms.jsDemo',
|
||||
abilityName: 'ohos.dms.jsDemo.LocalAbility',
|
||||
deviceId: localDeviceId,
|
||||
@ -103,8 +103,8 @@ export default {
|
||||
}
|
||||
if (this.remoteDeviceModel.discoverList.length > 0) {
|
||||
console.info('[dmsDemo] start to device');
|
||||
var name = null;
|
||||
for (var i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
let name = null;
|
||||
for (let i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
if (this.remoteDeviceModel.discoverList[i].deviceId === e.value) {
|
||||
name = this.remoteDeviceModel.discoverList[i].deviceName;
|
||||
break;
|
||||
@ -119,7 +119,7 @@ export default {
|
||||
let self = this;
|
||||
this.remoteDeviceModel.authDevice(e.value, () => {
|
||||
console.info('[dmsDemo] onRadioChangeForStart auth and online finished');
|
||||
for (i = 0; i < self.remoteDeviceModel.deviceList.length; i++) {
|
||||
for (let i = 0; i < self.remoteDeviceModel.deviceList.length; i++) {
|
||||
if (self.remoteDeviceModel.deviceList[i].deviceName === name) {
|
||||
this.startRemoteAbility(self.remoteDeviceModel.deviceList[i].deviceId,
|
||||
self.remoteDeviceModel.deviceList[i].deviceName);
|
||||
@ -128,7 +128,7 @@ export default {
|
||||
});
|
||||
} else {
|
||||
console.info('[dmsDemo] onRadioChangeForStart start to authed device');
|
||||
for (i = 0; i < this.remoteDeviceModel.deviceList.length; i++) {
|
||||
for (let i = 0; i < this.remoteDeviceModel.deviceList.length; i++) {
|
||||
if (this.remoteDeviceModel.deviceList[i].deviceId === e.value) {
|
||||
this.startRemoteAbility(this.remoteDeviceModel.deviceList[i].deviceId,
|
||||
this.remoteDeviceModel.deviceList[i].deviceName);
|
||||
@ -140,10 +140,10 @@ export default {
|
||||
|
||||
startRemoteAbility(deviceId, deviceName) {
|
||||
this.$element('dialogForStartAbility').close();
|
||||
var params;
|
||||
let params;
|
||||
console.info('[dmsDemo] featureAbility.startAbility deviceId=' + deviceId
|
||||
+ ' deviceName=' + deviceName);
|
||||
var wantValue = {
|
||||
const wantValue = {
|
||||
bundleName: 'ohos.dms.jsDemo',
|
||||
abilityName: 'ohos.dms.jsDemo.RemoteAbility',
|
||||
deviceId: deviceId,
|
||||
@ -190,8 +190,8 @@ export default {
|
||||
}
|
||||
if (this.remoteDeviceModel.discoverList.length > 0) {
|
||||
console.info('[dmsDemo] onRadioChangeForContinue to device');
|
||||
var name = null;
|
||||
for (var i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
let name = null;
|
||||
for (let i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
if (this.remoteDeviceModel.discoverList[i].deviceId === e.value) {
|
||||
name = this.remoteDeviceModel.discoverList[i].deviceName;
|
||||
break;
|
||||
@ -308,8 +308,8 @@ export default {
|
||||
}
|
||||
if (this.remoteDeviceModel.discoverList.length > 0) {
|
||||
console.info('[dmsDemo] onRadioChangeForConnect to device');
|
||||
var name = null;
|
||||
for (var i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
let name = null;
|
||||
for (let i = 0; i < this.remoteDeviceModel.discoverList.length; i++) {
|
||||
if (this.remoteDeviceModel.discoverList[i].deviceId === e.value) {
|
||||
name = this.remoteDeviceModel.discoverList[i].deviceName;
|
||||
break;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import deviceManager from '@ohos.distributedHardware.deviceManager';
|
||||
|
||||
var SUBSCRIBE_ID = 100;
|
||||
let SUBSCRIBE_ID = 100;
|
||||
|
||||
export default class RemoteDeviceModel {
|
||||
deviceList = [];
|
||||
@ -49,14 +49,14 @@ export default class RemoteDeviceModel {
|
||||
registerDeviceListCallback_(callback) {
|
||||
console.info('[dmsDemo] registerDeviceListCallback');
|
||||
this.callback = callback;
|
||||
if (this.#deviceManager == undefined) {
|
||||
if (this.#deviceManager === undefined) {
|
||||
console.error('[dmsDemo] deviceManager has not initialized');
|
||||
this.callback();
|
||||
return;
|
||||
}
|
||||
|
||||
console.info('[dmsDemo] getTrustedDeviceListSync begin');
|
||||
var list = this.#deviceManager.getTrustedDeviceListSync();
|
||||
const list = this.#deviceManager.getTrustedDeviceListSync();
|
||||
console.info('[dmsDemo] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list));
|
||||
if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') {
|
||||
this.deviceList = list;
|
||||
@ -70,7 +70,7 @@ export default class RemoteDeviceModel {
|
||||
registerServiceDieCallback();
|
||||
|
||||
SUBSCRIBE_ID = Math.floor(65536 * Math.random());
|
||||
var info = {
|
||||
const info = {
|
||||
subscribeId: SUBSCRIBE_ID,
|
||||
mode: 0xAA,
|
||||
medium: 2,
|
||||
@ -99,7 +99,7 @@ export default class RemoteDeviceModel {
|
||||
break;
|
||||
case 2:
|
||||
if (self.deviceList.length > 0) {
|
||||
for (var i = 0; i < self.deviceList.length; i++) {
|
||||
for (let i = 0; i < self.deviceList.length; i++) {
|
||||
if (self.deviceList[i].deviceId === data.device.deviceId) {
|
||||
self.deviceList[i] = data.device;
|
||||
break;
|
||||
@ -111,9 +111,9 @@ export default class RemoteDeviceModel {
|
||||
break;
|
||||
case 1:
|
||||
if (self.deviceList.length > 0) {
|
||||
var list = [];
|
||||
for (var i = 0; i < self.deviceList.length; i++) {
|
||||
if (self.deviceList[i].deviceId != data.device.deviceId) {
|
||||
const list = [];
|
||||
for (let i = 0; i < self.deviceList.length; i++) {
|
||||
if (self.deviceList[i].deviceId !== data.device.deviceId) {
|
||||
list[i] = data.device;
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ export default class RemoteDeviceModel {
|
||||
console.info('[dmsDemo] deviceFound data=' + JSON.stringify(data));
|
||||
console.info('[dmsDemo] deviceFound self.deviceList=' + self.deviceList);
|
||||
console.info('[dmsDemo] deviceFound self.deviceList.length=' + self.deviceList.length);
|
||||
for (var i = 0; i < self.discoverList.length; i++) {
|
||||
for (let i = 0; i < self.discoverList.length; i++) {
|
||||
if (self.discoverList[i].deviceId === data.device.deviceId) {
|
||||
console.info('[dmsDemo] device founded, ignored');
|
||||
return;
|
||||
@ -158,7 +158,7 @@ export default class RemoteDeviceModel {
|
||||
|
||||
authDevice(deviceId, callback) {
|
||||
console.info('[dmsDemo] authDevice ' + deviceId);
|
||||
for (var i = 0; i < this.discoverList.length; i++) {
|
||||
for (let i = 0; i < this.discoverList.length; i++) {
|
||||
if (this.discoverList[i].deviceId === deviceId) {
|
||||
console.info('[dmsDemo] device founded, ignored');
|
||||
let extraInfo = {
|
||||
|
@ -18,12 +18,12 @@ import Ability from '@ohos.application.Ability'
|
||||
import RemoteDeviceModel from '../Model/RemoteDeviceModel'
|
||||
import rpc from '@ohos.rpc'
|
||||
|
||||
var printLog = '[MainAbility]'
|
||||
var remoteDeviceModel = new RemoteDeviceModel
|
||||
var messageProxy = null
|
||||
var connectedAbility
|
||||
const printLog = '[MainAbility]';
|
||||
const remoteDeviceModel = new RemoteDeviceModel;
|
||||
let messageProxy = null;
|
||||
let connectedAbility;
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
onConnect: async function (elementName, proxy) {
|
||||
showLog(printLog + "service extension ability connect success")
|
||||
if (proxy === null) {
|
||||
@ -39,7 +39,7 @@ var options = {
|
||||
onFailed: function () {
|
||||
showLog(printLog + "service extension ability connect fail")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function ConnectRemoteAbility() {
|
||||
showLog(printLog + "connect service extension ability begin")
|
||||
@ -87,7 +87,7 @@ function showLog(logMessage) {
|
||||
function RegisterDeviceListCallback() {
|
||||
remoteDeviceModel.registerDeviceListCallback(() => {
|
||||
let deviceSize = remoteDeviceModel.deviceList.length
|
||||
for (var i = 0; i < deviceSize; i++) {
|
||||
for (let i = 0; i < deviceSize; i++) {
|
||||
globalThis.DeviceIdList.push(remoteDeviceModel.deviceList[i].deviceId)
|
||||
}
|
||||
})
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import deviceManager from '@ohos.distributedHardware.deviceManager';
|
||||
|
||||
var SUBSCRIBE_ID = 100;
|
||||
const SUBSCRIBE_ID = 100;
|
||||
|
||||
export default class RemoteDeviceModel {
|
||||
deviceList = [];
|
||||
@ -56,7 +56,7 @@ export default class RemoteDeviceModel {
|
||||
}
|
||||
|
||||
console.info('[ServiceExtensionDemo] getTrustedDeviceListSync begin');
|
||||
var list = this.MyDeviceManager.getTrustedDeviceListSync();
|
||||
const list = this.MyDeviceManager.getTrustedDeviceListSync();
|
||||
console.info('[ServiceExtensionDemo] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list));
|
||||
if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') {
|
||||
this.deviceList = list;
|
||||
@ -67,7 +67,7 @@ export default class RemoteDeviceModel {
|
||||
|
||||
getTrustDeviceList(callback) {
|
||||
console.info('[ServiceExtensionDemo] getTrustDeviceListSync begin');
|
||||
var list = this.MyDeviceManager.getTrustedDeviceListSync();
|
||||
const list = this.MyDeviceManager.getTrustedDeviceListSync();
|
||||
console.info('[ServiceExtensionDemo] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list));
|
||||
if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') {
|
||||
this.deviceList = list;
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
import rpc from '@ohos.rpc';
|
||||
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
|
||||
var printLog = '[ServiceExtension]'
|
||||
|
||||
const printLog = '[ServiceExtension]';
|
||||
|
||||
class MyServiceExtensionAbilityStub extends rpc.RemoteObject {
|
||||
constructor(des) {
|
||||
|
@ -162,7 +162,7 @@ struct StartAbility {
|
||||
})
|
||||
|
||||
Button() {
|
||||
Text('StartAbilityPromiseKSB004,跨设备,跨应用,对端FA的visable为false无法拉起')
|
||||
Text('StartAbilityPromiseKSB004,跨设备,跨应用,对端FA的visible为false无法拉起')
|
||||
.fontSize($r('app.float.font_20'))
|
||||
.width('100%')
|
||||
.fontColor(Color.White)
|
||||
|
@ -26,7 +26,7 @@ const PERMISSION_REJECT = -1
|
||||
class ContentStorage {
|
||||
}
|
||||
|
||||
var g_object = distributedObject.createDistributedObject({name:undefined});
|
||||
const g_object = distributedObject.createDistributedObject({name: undefined});
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user