未验证 提交 381508e2 编写于 作者: O openharmony_ci 提交者: Gitee

!22990 8.25 arkts warning

Merge pull request !22990 from maruiqazqaz/master
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
```js ```js
import data_rdb from '@ohos.data.rdb'; import data_rdb from '@ohos.data.rdb';
import { BusinessError } from "@ohos.base"
import window from '@ohos.window';
``` ```
## data_rdb.getRdbStore ## data_rdb.getRdbStore
...@@ -43,11 +45,11 @@ FA模型示例: ...@@ -43,11 +45,11 @@ FA模型示例:
```js ```js
// 获取context // 获取context
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext() let context: Context;
// 获取context后调用getRdbStore // 获取context后调用getRdbStore
const STORE_CONFIG = { name: "RdbTest.db"} const STORE_CONFIG = { name: "RdbTest.db"}
data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { data_rdb.getRdbStore(context, STORE_CONFIG, 1, (err, rdbStore) => {
if (err) { if (err) {
console.info("Get RdbStore failed, err: " + err) console.info("Get RdbStore failed, err: " + err)
return return
...@@ -62,22 +64,23 @@ Stage模型示例: ...@@ -62,22 +64,23 @@ Stage模型示例:
// 获取context // 获取context
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
let context; let context: Context;
class EntryAbility extends UIAbility { interface storeConfig {
onWindowStageCreate(windowStage){ name: string
context = this.context
}
} }
// 获取context后调用getRdbStore class EntryAbility extends UIAbility {
const STORE_CONFIG = { name: "RdbTest.db"} onWindowStageCreate(windowStage: window.WindowStage){
data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { let STORE_CONFIG: storeConfig = { name: "RdbTest.db"};
if (err) { data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, (err: BusinessError, rdbStore: data_rdb.RdbStore) => {
if (err) {
console.info("Get RdbStore failed, err: " + err) console.info("Get RdbStore failed, err: " + err)
return return
} }
console.log("Get RdbStore successfully.") console.log("Get RdbStore successfully.")
}) })
}
}
``` ```
## data_rdb.getRdbStore ## data_rdb.getRdbStore
...@@ -109,7 +112,7 @@ FA模型示例: ...@@ -109,7 +112,7 @@ FA模型示例:
```js ```js
// 获取context // 获取context
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext() let context: Context;
// 获取context后调用getRdbStore // 获取context后调用getRdbStore
const STORE_CONFIG = { name: "RdbTest.db" } const STORE_CONFIG = { name: "RdbTest.db" }
...@@ -127,20 +130,23 @@ Stage模型示例: ...@@ -127,20 +130,23 @@ Stage模型示例:
// 获取context // 获取context
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
let context; let context: Context;
interface storeConfig {
name: string
}
class EntryAbility extends UIAbility { class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage){ onWindowStageCreate(windowStage: window.WindowStage){
context = this.context context = this.context
} }
} }
// 获取context后调用getRdbStore // 获取context后调用getRdbStore
const STORE_CONFIG = { name: "RdbTest.db" } let STORE_CONFIG: storeConfig = { name: "RdbTest.db"};
let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1); let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1);
promise.then(async (rdbStore) => { promise.then(async (rdbStore: data_rdb.RdbStore) => {
console.log("Get RdbStore successfully.") console.log("Get RdbStore successfully.")
}).catch((err) => { }).catch((err: BusinessError) => {
console.log("Get RdbStore failed, err: " + err) console.log("Get RdbStore failed, err: " + err)
}) })
``` ```
...@@ -167,15 +173,15 @@ FA模型示例: ...@@ -167,15 +173,15 @@ FA模型示例:
```js ```js
// 获取context // 获取context
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext() let context: Context;
// 获取context后调用deleteRdbStore // 获取context后调用deleteRdbStore
data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { data_rdb.deleteRdbStore(context, "RdbTest.db", (err) => {
if (err) { if (err) {
console.info("Delete RdbStore failed, err: " + err) console.info("Delete RdbStore failed, err: " + err)
return return
} }
console.log("Delete RdbStore successfully.") console.log("Delete RdbStore successfully.")
}) })
``` ```
...@@ -185,20 +191,20 @@ Stage模型示例: ...@@ -185,20 +191,20 @@ Stage模型示例:
// 获取context // 获取context
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
let context; let context: Context;
class EntryAbility extends UIAbility { class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage){ onWindowStageCreate(windowStage: window.WindowStage){
context = this.context context = this.context
} }
} }
// 获取context后调用deleteRdbStore // 获取context后调用deleteRdbStore
data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { data_rdb.deleteRdbStore(context, "RdbTest.db", (err) => {
if (err) { if (err) {
console.info("Delete RdbStore failed, err: " + err) console.info("Delete RdbStore failed, err: " + err)
return return
} }
console.log("Delete RdbStore successfully.") console.log("Delete RdbStore successfully.")
}) })
``` ```
...@@ -230,7 +236,7 @@ FA模型示例: ...@@ -230,7 +236,7 @@ FA模型示例:
```js ```js
// 获取context // 获取context
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext() let context: Context;
// 获取context后调用deleteRdbStore // 获取context后调用deleteRdbStore
let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") let promise = data_rdb.deleteRdbStore(context, "RdbTest.db")
...@@ -247,19 +253,19 @@ Stage模型示例: ...@@ -247,19 +253,19 @@ Stage模型示例:
// 获取context // 获取context
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
let context; let context: Context;
class EntryAbility extends UIAbility { class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage){ onWindowStageCreate(windowStage: window.WindowStage){
context = this.context context = this.context
} }
} }
// 获取context后调用deleteRdbStore // 获取context后调用deleteRdbStore
let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") let promise = data_rdb.deleteRdbStore(context, "RdbTest.db")
promise.then(()=>{ promise.then(()=>{
console.log("Delete RdbStore successfully.") console.log("Delete RdbStore successfully.")
}).catch((err) => { }).catch((err: BusinessError) => {
console.info("Delete RdbStore failed, err: " + err) console.info("Delete RdbStore failed, err: " + err)
}) })
``` ```
...@@ -371,8 +377,8 @@ inDevices(devices: Array<string>): RdbPredicates ...@@ -371,8 +377,8 @@ inDevices(devices: Array<string>): RdbPredicates
```js ```js
import deviceManager from '@ohos.distributedHardware.deviceManager'; import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null; let dmInstance: deviceManager.DeviceManager = null;
let deviceIds = []; let deviceIds: Array<string> = [];
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) { if (err) {
...@@ -381,7 +387,7 @@ deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) ...@@ -381,7 +387,7 @@ deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager)
} }
dmInstance = manager; dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync(); let devices = dmInstance.getTrustedDeviceListSync();
for (var i = 0; i < devices.length; i++) { for (let i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId; deviceIds[i] = devices[i].deviceId;
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册