提交 86314cca 编写于 作者: X xsz233 提交者: ShiZhe Xu

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: Nxsz233 <xushizhe@huawei.com>
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/api_doc.iml" filepath="$PROJECT_DIR$/.idea/api_doc.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -460,62 +460,64 @@ zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md @RaySh
zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md @RayShih @littlejerry1 @gwang2008 @ccllee @chengxingzhen
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @RayShih @littlejerry1 @gwang2008 @ccllee @chengxingzhen
zh-cn/application-dev/reference/errorcodes/errcode-ability.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-access-token.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-accessibility.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-account.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-animator.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-app-account.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-audio.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-avsession.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-backgroundTaskMgr.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-batteryStatistics.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-brightness.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-buffer.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-bundle.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-colorspace-manager.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-CommonEventService.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-containers.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-data-rdb.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-datashare.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-device-manager.md @qinxiaowang
zh-cn/application-dev/reference/errorcodes/errcode-DeviceUsageStatistics.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-display.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-distributed-dataObject.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-distributedKVStore.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-DistributedNotificationService.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-enterpriseDeviceManager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-faultlogger.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-filemanagement.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-geoLocationManager.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-hiappevent.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-hisysevent.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-hiviewdfx-hidebug.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-huks.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-i18n.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-inputmethod-framework.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-multimodalinput.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-nfc.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-pasteboard.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-power.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-preferences.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-promptAction.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-reminderAgentManager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-request.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-resource-manager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-router.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-rpc.md @qinxiaowang
zh-cn/application-dev/reference/errorcodes/errcode-runninglock.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-sensor.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-system-parameterV9.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-thermal.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errcode-uitest.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-universal.md @RayShih
zh-cn/application-dev/reference/errorcodes/errcode-update.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-usb.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-vibrator.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-webview.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-window.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errcode-workScheduler.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errcode-zlib.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-ability.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-access-token.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-accessibility.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-account.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-animator.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-app-account.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-audio.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-avsession.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-batteryStatistics.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-brightness.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-buffer.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-colorspace-manager.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-CommonEventService.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-containers.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-data-rdb.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-datashare.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-device-manager.md @qinxiaowang
zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-display.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-filemanagement.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-geoLocationManager.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-hiappevent.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-hisysevent.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-huks.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-i18n.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-multimodalinput.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-pasteboard.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-power.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-promptAction.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-request.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-resource-manager.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-router.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-rpc.md @qinxiaowang
zh-cn/application-dev/reference/errorcodes/errorcode-runninglock.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-sensor.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-system-parameterV9.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-thermal.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-uitest.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-universal.md @RayShih
zh-cn/application-dev/reference/errorcodes/errorcode-update.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-usb.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-useriam.md @zengyawen
zh-cn/application-dev/reference/errorcodes/errorcode-vibrator.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-webview.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-window.md @ge-yafang
zh-cn/application-dev/reference/errorcodes/errorcode-workScheduler.md @HelloCrease
zh-cn/application-dev/reference/errorcodes/errorcode-zlib.md @RayShih
zh-cn/release-notes/changelogs @majiajun518
\ No newline at end of file
......@@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences';
| Name | Type| Readable| Writable| Description |
| ---------------- | -------- | ---- | ---- | --------------------------------------- |
| MAX_KEY_LENGTH | string | Yes | No | Maximum length of a key. The key must be less than 80 bytes. |
| MAX_VALUE_LENGTH | string | Yes | No | Maximum length of a value. The value must be less than 8192 bytes.|
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. The key must be less than 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. The value must be less than 8192 bytes.|
## data_preferences.getPreferences
......@@ -50,16 +50,19 @@ FA model:
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let preferences = null;
data_preferences.getPreferences(context, 'mystore', function (err, object) {
try {
data_preferences.getPreferences(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to get the preferences. Cause: " + err);
console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = object;
console.info("Got the preferences successfully.");
})
})
} catch (err) {
console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -75,14 +78,17 @@ class MainAbility extends Ability{
}
let preferences = null;
data_preferences.getPreferences(context, 'mystore', function (err, object) {
try {
data_preferences.getPreferences(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to get the preferences. Cause: " + err);
console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = object;
console.info("Got the preferences successfully.");
})
})
} catch (err) {
console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
}
```
## data_preferences.getPreferences
......@@ -116,13 +122,17 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let preferences = null;
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((object) => {
try {
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((object) => {
preferences = object;
console.info("Got the preferences successfully.");
}).catch((err) => {
console.info("Failed to get the preferences. Cause: " + err);
})
}).catch((err) => {
console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -138,13 +148,17 @@ class MainAbility extends Ability{
}
let preferences = null;
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((object) => {
try {
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((object) => {
preferences = object;
console.info("Got the preferences successfully.");
}).catch((err) => {
console.info("Failed to get the preferences. Cause: " + err);
})
}).catch((err) => {
console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message);
}
```
## data_preferences.deletePreferences
......@@ -167,6 +181,14 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi
| name | string | Yes | Name of the **Preferences** instance to delete. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.|
**Error codes**
For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md).
| ID| Error Message |
| -------- | ------------------------------|
| 15500010 | Failed to delete the preferences. |
**Example**
FA model:
......@@ -176,13 +198,17 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
data_preferences.deletePreferences(context, 'mystore', function (err) {
try {
data_preferences.deletePreferences(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to delete the preferences. Cause: " + err);
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Deleted the preferences successfully." );
})
})
} catch (err) {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -197,13 +223,17 @@ class MainAbility extends Ability{
}
}
data_preferences.deletePreferences(context, 'mystore', function (err) {
try {
data_preferences.deletePreferences(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to delete the preferences. Cause: " + err);
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Deleted the preferences successfully." );
})
})
} catch (err) {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
}
```
## data_preferences.deletePreferences
......@@ -231,6 +261,14 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md).
| ID| Error Message |
| -------- | ------------------------------|
| 15500010 | Failed to delete the preferences. |
**Example**
FA model:
......@@ -240,12 +278,16 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let promise = data_preferences.deletePreferences(context, 'mystore');
promise.then(() => {
try {
let promise = data_preferences.deletePreferences(context, 'mystore');
promise.then(() => {
console.info("Deleted the preferences successfully.");
}).catch((err) => {
console.info("Failed to delete the preferences. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -260,12 +302,16 @@ class MainAbility extends Ability{
}
}
let promise = data_preferences.deletePreferences(context, 'mystore');
promise.then(() => {
try{
let promise = data_preferences.deletePreferences(context, 'mystore');
promise.then(() => {
console.info("Deleted the preferences successfully.");
}).catch((err) => {
console.info("Failed to delete the preferences. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
}
```
## data_preferences.removePreferencesFromCache
......@@ -295,13 +341,17 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
data_preferences.removePreferencesFromCache(context, 'mystore', function (err) {
try {
data_preferences.removePreferencesFromCache(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to remove the preferences. Cause: " + err);
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Removed the preferences successfully.");
})
})
} catch (err) {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -316,13 +366,18 @@ class MainAbility extends Ability{
}
}
data_preferences.removePreferencesFromCache(context, 'mystore', function (err) {
try {
data_preferences.removePreferencesFromCache(context, 'mystore', function (err, val) {
if (err) {
console.info("Failed to remove the preferences. Cause: " + err);
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Removed the preferences successfully.");
})
})
} catch (err) {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
}
```
## data_preferences.removePreferencesFromCache
......@@ -357,12 +412,16 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
promise.then(() => {
try {
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
promise.then(() => {
console.info("Removed the preferences successfully.");
}).catch((err) => {
console.info("Failed to remove the preferences. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
}
```
Stage model:
......@@ -377,12 +436,16 @@ class MainAbility extends Ability{
}
}
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
promise.then(() => {
try {
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
promise.then(() => {
console.info("Removed the preferences successfully.");
}).catch((err) => {
console.info("Failed to remove the preferences. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message);
}
```
## Preferences
......@@ -411,13 +474,17 @@ Obtains the value of a key. This API uses an asynchronous callback to return the
**Example**
```js
preferences.get('startup', 'default', function(err, data) {
try {
preferences.get('startup', 'default', function (err, val) {
if (err) {
console.info("Failed to get the value of 'startup'. Cause: " + err);
console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Got the value of 'startup'. Data: " + data);
})
console.info("Obtained the value of 'startup' successfully. val: " + val);
})
} catch (err) {
console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
......@@ -445,12 +512,16 @@ Obtains the value of a key. This API uses a promise to return the result. If the
**Example**
```js
let promise = preferences.get('startup', 'default');
promise.then((data) => {
try {
let promise = preferences.get('startup', 'default');
promise.then((data) => {
console.info("Got the value of 'startup'. Data: " + data);
}).catch((err) => {
console.info("Failed to get the value of 'startup'. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
### getAll
......@@ -470,15 +541,19 @@ Obtains an **Object** instance that contains all KV pairs. This API uses an asyn
**Example**
```js
preferences.getAll(function (err, value) {
try {
preferences.getAll(function (err, value) {
if (err) {
console.info("Failed to get all KV pairs. Cause: " + err);
console.info("Failed to get all KV pairs. code =" + err.code + ", message =" + err.message);
return;
}
let allKeys = Object.keys(value);
console.info("getAll keys = " + allKeys);
console.info("getAll object = " + JSON.stringify(value));
});
})
} catch (err) {
console.info("Failed to get all KV pairs. code =" + err.code + ", message =" + err.message);
}
```
......@@ -499,14 +574,18 @@ Obtains an **Object** instance that contains all KV pairs. This API uses a promi
**Example**
```js
let promise = preferences.getAll();
promise.then((value) => {
try {
let promise = preferences.getAll();
promise.then((value) => {
let allKeys = Object.keys(value);
console.info('getAll keys = ' + allKeys);
console.info("getAll object = " + JSON.stringify(value));
}).catch((err) => {
console.info("Failed to get all KV pairs. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to get all KV pairs. code =" + err.code + ", message =" + err.message);
})
} catch (err) {
console.info("Failed to get all KV pairs. code =" + err.code + ", message =" + err.message);
}
```
### put
......@@ -528,13 +607,17 @@ Writes data to this **Preferences** instance. This API uses an asynchronous call
**Example**
```js
preferences.put('startup', 'auto', function (err) {
try {
preferences.put('startup', 'auto', function (err) {
if (err) {
console.info("Failed to put the value of 'startup'. Cause: " + err);
console.info("Failed to put the value of 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Put the value of 'startup' successfully.");
})
})
} catch (err) {
console.info("Failed to put the value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
......@@ -562,12 +645,16 @@ Writes data to this **Preferences** instance. This API uses a promise to return
**Example**
```js
let promise = preferences.put('startup', 'auto');
promise.then(() => {
try {
let promise = preferences.put('startup', 'auto');
promise.then(() => {
console.info("Put the value of 'startup' successfully.");
}).catch((err) => {
console.info("Failed to put the value of 'startup'. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to put the value of 'startup'. code =" + err.code +", message =" + err.message);
})
} catch(err) {
console.info("Failed to put the value of 'startup'. code =" + err.code +", message =" + err.message);
}
```
......@@ -589,17 +676,21 @@ Checks whether this **Preferences** instance contains a KV pair with the given k
**Example**
```js
preferences.has('startup', function (err, isExist) {
try {
preferences.has('startup', function (err, val) {
if (err) {
console.info("Failed to check the key 'startup'. Cause: " + err);
console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
if (isExist) {
if (val) {
console.info("The key 'startup' is contained.");
} else {
console.info("The key 'startup' is not contained.");
}
})
})
} catch (err) {
console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
......@@ -626,16 +717,20 @@ Checks whether this **Preferences** instance contains a KV pair with the given k
**Example**
```js
let promise = preferences.has('startup');
promise.then((isExist) => {
if (isExist) {
try {
let promise = preferences.has('startup');
promise.then((val) => {
if (val) {
console.info("The key 'startup' is contained.");
} else {
console.info("The key 'startup' is not contained.");
}
}).catch((err) => {
console.info("Failed to check the key 'startup'. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
......@@ -643,7 +738,7 @@ promise.then((isExist) => {
delete(key: string, callback: AsyncCallback&lt;void&gt;): void
Deletes a KV pair from this **Preferences** instance. This API uses an asynchronous callback to return the result.
Deletes a KV pair from this **Preferences** instance based on the specified key. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......@@ -657,13 +752,17 @@ Deletes a KV pair from this **Preferences** instance. This API uses an asynchron
**Example**
```js
preferences.delete('startup', function (err) {
try {
preferences.delete('startup', function (err) {
if (err) {
console.info("Failed to delete the key 'startup'. Cause: " + err);
console.info("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Deleted the key 'startup'.");
})
})
} catch (err) {
console.info("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
......@@ -690,12 +789,16 @@ Deletes a KV pair from this **Preferences** instance. This API uses a promise to
**Example**
```js
let promise = preferences.delete('startup');
promise.then(() => {
try {
let promise = preferences.delete('startup');
promise.then(() => {
console.info("Deleted the key 'startup'.");
}).catch((err) => {
console.info("Failed to delete the key 'startup'. Cause: " + err);
})
}).catch((err) => {
console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
})
} catch(err) {
console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
}
```
......@@ -716,13 +819,17 @@ Saves the data of this **Preferences** instance to a file asynchronously. This A
**Example**
```js
preferences.flush(function (err) {
try {
preferences.flush(function (err) {
if (err) {
console.info("Failed to flush data. Cause: " + err);
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Flushed data successfully.");
})
})
} catch (err) {
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
}
```
......@@ -743,12 +850,16 @@ Saves the data of this **Preferences** instance to a file asynchronously. This A
**Example**
```js
let promise = preferences.flush();
promise.then(() => {
console.info("Flushed data to file successfully.")
}).catch((err) => {
console.info("Failed to flush data. Cause: " + err);
})
try {
let promise = preferences.flush();
promise.then(() => {
console.info("Flushed data successfully.");
}).catch((err) => {
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
})
} catch (err) {
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
}
```
......@@ -769,13 +880,17 @@ Clears this **Preferences** instance. This API uses an asynchronous callback to
**Example**
```js
preferences.clear(function (err) {
try {
preferences.clear(function (err) {
if (err) {
console.info("Failed to clear data. Cause: " + err);
console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Cleared data successfully.");
})
})
} catch (err) {
console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
}
```
......@@ -796,12 +911,16 @@ Clears this **Preferences** instance. This API uses a promise to return the resu
**Example**
```js
let promise = preferences.clear()
promise.then(() => {
try {
let promise = preferences.clear();
promise.then(() => {
console.info("Cleared data successfully.");
}).catch((err) => {
console.info("Failed to clear data. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
}
```
......@@ -823,7 +942,8 @@ Subscribes to data changes. A callback will be triggered to return the new value
**Example**
```js
data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
try {
data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
if (err) {
console.info("Failed to get the preferences.");
return;
......@@ -844,10 +964,13 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen
console.info("Failed to flush data. Cause: " + err);
return;
}
console.info("Flushed data successfully."); // The observer will be called.
console.info("Flushed data successfully.");
})
})
})
})
} catch (err) {
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
}
```
......@@ -869,7 +992,8 @@ Unsubscribes from data changes.
**Example**
```js
data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
try {
data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
if (err) {
console.info("Failed to get the preferences.");
return;
......@@ -890,11 +1014,14 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen
console.info("Failed to flush data. Cause: " + err);
return;
}
console.info("Flushed data successfully."); // The observer will be called.
console.info("Flushed data successfully.");
})
preferences.off('change', observer);
})
})
})
} catch (err) {
console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
}
```
## ValueType
......
......@@ -2,13 +2,551 @@
A result set is a set of results returned after the relational database (RDB) query APIs are called. You can use the **resultset** APIs to obtain required data.
> **NOTE**<br/>
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Usage
## ResultSetV9<sup>9+</sup>
You need to use [RdbStore.query()](js-apis-data-rdb.md#query) to obtain a **resultSet** object.
Provides methods to access the result set, which is obtained by querying the RDB store.
### Usage
You need to obtain the **resultSetV9** instance by using [RdbStoreV9.query()](js-apis-data-rdb.md#query).
```js
import dataRdb from '@ohos.data.rdb';
let predicatesV9 = new dataRdb.RdbPredicatesV9("EMPLOYEE");
predicatesV9.equalTo("AGE", 18);
let promise = rdbStoreV9.query(predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSetV9) => {
console.log(TAG + "resultSet columnNames:" + resultSetV9.columnNames);
console.log(TAG + "resultSet columnCount:" + resultSetV9.columnCount);
});
```
### Attributes<sup>9+</sup>
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Type | Mandatory| Description |
| ------------ | ------------------- | ---- | -------------------------------- |
| columnNames | Array&lt;string&gt; | Yes | Names of all columns in the result set. |
| columnCount | number | Yes | Number of columns in the result set. |
| rowCount | number | Yes | Number of rows in the result set. |
| rowIndex | number | Yes | Index of the current row in the result set. |
| isAtFirstRow | boolean | Yes | Whether the cursor is in the first row of the result set. |
| isAtLastRow | boolean | Yes | Whether the cursor is in the last row of the result set. |
| isEnded | boolean | Yes | Whether the cursor is after the last row of the result set.|
| isStarted | boolean | Yes | Whether the cursor has been moved. |
| isClosed | boolean | Yes | Whether the result set is closed. |
### getColumnIndex<sup>9+</sup>
getColumnIndex(columnName: string): number
Obtains the column index based on the column name.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------------------- |
| columnName | string | Yes | Column name specified.|
**Return value**
| Type | Description |
| ------ | ------------------ |
| number | Index of the column obtained.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
resultSetV9.goToFirstRow();
const id = resultSetV9.getLong(resultSetV9.getColumnIndex("ID"));
const name = resultSetV9.getString(resultSetV9.getColumnIndex("NAME"));
const age = resultSetV9.getLong(resultSetV9.getColumnIndex("AGE"));
const salary = resultSetV9.getDouble(resultSetV9.getColumnIndex("SALARY"));
```
### getColumnName<sup>9+</sup>
getColumnName(columnIndex: number): string
Obtains the column name based on the column index.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | -------------------------- |
| columnIndex | number | Yes | Column index specified.|
**Return value**
| Type | Description |
| ------ | ------------------ |
| string | Column name obtained.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const id = resultSetV9.getColumnName(0);
const name = resultSetV9.getColumnName(1);
const age = resultSetV9.getColumnName(2);
```
### goTo<sup>9+</sup>
goTo(offset:number): boolean
Moves the cursor to the row based on the specified offset.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------- |
| offset | number | Yes | Offset relative to the current position.|
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9goto = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygoto = rdbStoreV9.query(predicatesV9goto, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoto.then((resultSetV9) => {
resultSetV9.goTo(1);
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### goToRow<sup>9+</sup>
goToRow(position: number): boolean
Moves the cursor to the specified row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------ | ---- | ------------------------ |
| position | number | Yes | Position to which the cursor is to be moved.|
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9gotorow = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygotorow = rdbStoreV9.query(predicatesV9gotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygotorow.then((resultSetV9) => {
resultSetV9.goToRow(5);
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### goToFirstRow<sup>9+</sup>
goToFirstRow(): boolean
Moves the cursor to the first row of the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9goFirst = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygoFirst = rdbStoreV9.query(predicatesV9goFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoFirst.then((resultSetV9) => {
resultSetV9.goToFirstRow();
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### goToLastRow<sup>9+</sup>
goToLastRow(): boolean
Moves the cursor to the last row of the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9goLast = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygoLast = rdbStoreV9.query(predicatesV9goLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoLast.then((resultSetV9) => {
resultSetV9.goToLastRow();
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### goToNextRow<sup>9+</sup>
goToNextRow(): boolean
Moves the cursor to the next row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9goNext = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygoNext = rdbStoreV9.query(predicatesV9goNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoNext.then((resultSetV9) => {
resultSetV9.goToNextRow();
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### goToPreviousRow<sup>9+</sup>
goToPreviousRow(): boolean
Moves the cursor to the previous row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type | Description |
| ------- | --------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
**Example**
```js
let predicatesV9goPrev = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promisequerygoPrev = rdbStoreV9.query(predicatesV9goPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoPrev.then((resultSetV9) => {
resultSetV9.goToPreviousRow();
resultSetV9.close();
}).catch((err) => {
console.log('query failed');
});
```
### getBlob<sup>9+</sup>
getBlob(columnIndex: number): Uint8Array
Obtains the value in the specified column in the current row as a byte array.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------- |
| columnIndex | number | Yes | Index of the specified column, starting from 0.|
**Return value**
| Type | Description |
| ---------- | -------------------------------- |
| Uint8Array | Value in the specified column as a byte array.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const codes = resultSetV9.getBlob(resultSetV9.getColumnIndex("CODES"));
```
### getString<sup>9+</sup>
getString(columnIndex: number): string
Obtains the value in the specified column in the current row as a string.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------- |
| columnIndex | number | Yes | Index of the specified column, starting from 0.|
**Return value**
| Type | Description |
| ------ | ---------------------------- |
| string | Value in the specified column as a string.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const name = resultSetV9.getString(resultSetV9.getColumnIndex("NAME"));
```
### getLong<sup>9+</sup>
getLong(columnIndex: number): number
Obtains the value in the specified column in the current row as a Long.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------- |
| columnIndex | number | Yes | Index of the specified column, starting from 0.|
**Return value**
| Type | Description |
| ------ | -------------------------- |
| number | Value in the specified column as a Long.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const age = resultSetV9.getLong(resultSetV9.getColumnIndex("AGE"));
```
### getDouble<sup>9+</sup>
getDouble(columnIndex: number): number
Obtains the value in the specified column in the current row as a double.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------- |
| columnIndex | number | Yes | Index of the specified column, starting from 0.|
**Return value**
| Type | Description |
| ------ | ---------------------------- |
| number | Value in the specified column as a double.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const salary = resultSetV9.getDouble(resultSetV9.getColumnIndex("SALARY"));
```
### isColumnNull<sup>9+</sup>
isColumnNull(columnIndex: number): boolean
Checks whether the value in the specified column of the current row is null.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------- |
| columnIndex | number | Yes | Index of the specified column, starting from 0.|
**Return value**
| Type | Description |
| ------- | --------------------------------------------------------- |
| boolean | Returns **true** if the value is null; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**Example**
```js
const isColumnNull = resultSetV9.isColumnNull(resultSetV9.getColumnIndex("CODES"));
```
### close<sup>9+</sup>
close(): void
Closes this result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example**
```js
let predicatesV9Close = new dataRdb.RdbPredicatesV9("EMPLOYEE");
let promiseClose = rdbStoreV9.query(predicatesV9Close, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promiseClose.then((resultSetV9) => {
resultSetV9.close();
}).catch((err) => {
console.log('Failed to close the resultset');
});
```
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| ID| **Error Message** |
| ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty or the specified location is invalid. |
## ResultSet<sup>(deprecated)</sup>
Provides methods to access the result set, which is obtained by querying the RDB store.
> **NOTE**
>
> This object is supported since API version 7 and deprecated since API version 9. You are advised to use [ResultSetV9](#resultsetv99).
### Usage
You need to obtain a **resultSet** object by using [RdbStore.query()](js-apis-data-rdb.md#query).
```js
import dataRdb from '@ohos.data.rdb';
......@@ -21,11 +559,11 @@ promise.then((resultSet) => {
});
```
## ResultSet
### Attributes<sup>(deprecated)</sup>
Provides methods to access the result set, which is obtained by querying the RDB store.
### Attributes
> **NOTE**
>
> This parameter is supported since API version 7 and is deprecated since API version 9. You are advised to use [Attributes](#attributes9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
......@@ -41,25 +579,29 @@ Provides methods to access the result set, which is obtained by querying the RDB
| isStarted | boolean | Yes| Whether the cursor has been moved.|
| isClosed | boolean | Yes| Whether the result set is closed.|
### getColumnIndex
### getColumnIndex<sup>(deprecated)</sup>
getColumnIndex(columnName: string): number
Obtains the column index based on the column name.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getColumnIndex](#getcolumnindex9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnName | string | Yes| Column name specified.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnName | string | Yes| Column name specified.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Index of the column obtained.|
| Type| Description|
| -------- | -------- |
| number | Index of the column obtained.|
**Example**
......@@ -71,25 +613,29 @@ Obtains the column index based on the column name.
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
```
### getColumnName
### getColumnName<sup>(deprecated)</sup>
getColumnName(columnIndex: number): string
Obtains the column name based on the column index.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getColumnName](#getcolumnname9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Column index specified.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Column index specified.|
**Return value**
| Type| Description|
| -------- | -------- |
| string | Column name obtained.|
| Type| Description|
| -------- | -------- |
| string | Column name obtained.|
**Example**
......@@ -99,32 +645,36 @@ Obtains the column name based on the column index.
const age = resultSet.getColumnName(2);
```
### goTo
### goTo<sup>(deprecated)</sup>
goTo(offset:number): boolean
Moves the cursor to the row based on the specified offset.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goTo](#goto9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| offset | number | Yes| Offset relative to the current position.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| offset | number | Yes| Offset relative to the current position.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoto.then((resultSet) {
promisequerygoto.then((resultSet) => {
resultSet.goTo(1);
resultSet.close();
}).catch((err) => {
......@@ -132,32 +682,36 @@ Moves the cursor to the row based on the specified offset.
});
```
### goToRow
### goToRow<sup>(deprecated)</sup>
goToRow(position: number): boolean
Moves the cursor to the specified row in the result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goToRow](#gotorow9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| position | number | Yes| Position to which the cursor is to be moved.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| position | number | Yes| Position to which the cursor is to be moved.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygotorow.then((resultSet) {
promisequerygotorow.then((resultSet) => {
resultSet.goToRow(5);
resultSet.close();
}).catch((err) => {
......@@ -165,27 +719,30 @@ Moves the cursor to the specified row in the result set.
});
```
### goToFirstRow
### goToFirstRow<sup>(deprecated)</sup>
goToFirstRow(): boolean
Moves the cursor to the first row of the result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goToFirstRow](#gotofirstrow9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoFirst.then((resultSet) {
promisequerygoFirst.then((resultSet) => {
resultSet.goToFirstRow();
resultSet.close();
}).catch((err) => {
......@@ -193,26 +750,30 @@ Moves the cursor to the first row of the result set.
});
```
### goToLastRow
### goToLastRow<sup>(deprecated)</sup>
goToLastRow(): boolean
Moves the cursor to the last row of the result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goToLastRow](#gotolastrow9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoLast.then((resultSet) {
promisequerygoLast.then((resultSet) => {
resultSet.goToLastRow();
resultSet.close();
}).catch((err) => {
......@@ -220,26 +781,30 @@ Moves the cursor to the last row of the result set.
});
```
### goToNextRow
### goToNextRow<sup>(deprecated)</sup>
goToNextRow(): boolean
Moves the cursor to the next row in the result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goToNextRow](#gotonextrow9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoNext.then((resultSet) {
promisequerygoNext.then((resultSet) => {
resultSet.goToNextRow();
resultSet.close();
}).catch((err) => {
......@@ -247,26 +812,30 @@ Moves the cursor to the next row in the result set.
});
```
### goToPreviousRow
### goToPreviousRow<sup>(deprecated)</sup>
goToPreviousRow(): boolean
Moves the cursor to the previous row in the result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [goToPreviousRow](#gotopreviousrow9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```js
let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoPrev.then((resultSet) {
promisequerygoPrev.then((resultSet) => {
resultSet.goToPreviousRow();
resultSet.close();
}).catch((err) => {
......@@ -274,25 +843,29 @@ Moves the cursor to the previous row in the result set.
});
```
### getBlob
### getBlob<sup>(deprecated)</sup>
getBlob(columnIndex: number): Uint8Array
Obtains the value in the specified column in the current row as a byte array.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getBlob](#getblob9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value**
| Type| Description|
| -------- | -------- |
| Uint8Array | Value in the specified column as a byte array.|
| Type| Description|
| -------- | -------- |
| Uint8Array | Value in the specified column as a byte array.|
**Example**
......@@ -300,25 +873,29 @@ Obtains the value in the specified column in the current row as a byte array.
const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES"));
```
### getString
### getString<sup>(deprecated)</sup>
getString(columnIndex: number): string
Obtains the value in the specified column in the current row as a string.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getString](#getstring9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value**
| Type| Description|
| -------- | -------- |
| string | Value in the specified column as a string.|
| Type| Description|
| -------- | -------- |
| string | Value in the specified column as a string.|
**Example**
......@@ -326,25 +903,29 @@ Obtains the value in the specified column in the current row as a string.
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
```
### getLong
### getLong<sup>(deprecated)</sup>
getLong(columnIndex: number): number
Obtains the value in the specified column in the current row as a Long.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getLong](#getlong9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a Long.|
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a Long.|
**Example**
......@@ -352,25 +933,29 @@ Obtains the value in the specified column in the current row as a Long.
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
```
### getDouble
### getDouble<sup>(deprecated)</sup>
getDouble(columnIndex: number): number
Obtains the value in the specified column in the current row as a double.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getDouble](#getdouble9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a double.|
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a double.|
**Example**
......@@ -378,25 +963,29 @@ Obtains the value in the specified column in the current row as a double.
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
```
### isColumnNull
### isColumnNull<sup>(deprecated)</sup>
isColumnNull(columnIndex: number): boolean
Checks whether the value in the specified column of the current row is null.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isColumnNull](#iscolumnnull9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the value is null; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the value is null; returns **false** otherwise.|
**Example**
......@@ -404,12 +993,16 @@ Checks whether the value in the specified column of the current row is null.
const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES"));
```
### close
### close<sup>(deprecated)</sup>
close(): void
Closes this result set.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [close](#close9).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example**
......@@ -417,9 +1010,9 @@ Closes this result set.
```js
let predicatesClose = new dataRdb.RdbPredicates("EMPLOYEE");
let promiseClose = rdbStore.query(predicatesClose, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promiseClose.then((resultSet) {
promiseClose.then((resultSet) => {
resultSet.close();
}).catch((err) => {
console.log('Failed to close resultset');
console.log('Failed to close the resultset');
});
```
......@@ -22,10 +22,10 @@ import data_storage from '@ohos.data.storage';
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
| Name | Type | Readable | Writable | Description |
| ---------------- | ------ | -------- | -------- | ----------------------------------------------------------- |
| MAX_KEY_LENGTH | string | Yes | No | Maximum length of a key. It must be less than 80 bytes. |
| MAX_VALUE_LENGTH | string | Yes | No | Maximum length of a value. It must be less than 8192 bytes. |
| Name | Type| Readable| Writable| Description |
| ---------------- | -------- | ---- | ---- | ------------------------------------- |
| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. It must be less than 80 bytes. |
| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. It must be less than 8192 bytes.|
## data_storage.getStorageSync
......@@ -53,8 +53,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -86,8 +86,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -129,8 +129,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -165,8 +165,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -195,8 +195,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -237,8 +237,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -271,8 +271,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -302,8 +302,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -344,8 +344,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```js
import featureAbility from '@ohos.ability.featureAbility';
var path;
var context = featureAbility.getContext();
let path;
let context = featureAbility.getContext();
context.getFilesDir().then((filePath) => {
path = filePath;
console.info("======================>getFilesDirPromise====================>");
......@@ -864,15 +864,15 @@ Subscribes to data changes. The **StorageObserver** needs to be implemented. Whe
**Parameters**
| Name | Type | Description |
| -------- | --------------------------------------------------- | ---------------------------------------- |
| type | string | Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Callback used to return data changes. |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ------ |---------------------------------------- |
| type | string |Yes| Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback used to return data changes. |
**Example**
```js
var observer = function (key) {
let observer = function (key) {
console.info("The key of " + key + " changed.");
}
storage.on('change', observer);
......@@ -891,15 +891,15 @@ Unsubscribes from data changes.
**Parameters**
| Name | Type | Description |
| -------- | --------------------------------------------------- | ---------------------------------------- |
| type | string | Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Callback used to return data changes. |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ------ |---------------------------------------- |
| type | string |Yes| Event type. The value **change** indicates data change events.|
| callback | Callback&lt;[StorageObserver](#storageobserver)&gt; | Yes|Callback used to return data changes. |
**Example**
```js
var observer = function (key) {
let observer = function (key) {
console.info("The key of " + key + " changed.");
}
storage.off('change', observer);
......
# HUKS
The **HUKS** module provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations.
The keys managed by OpenHarmony Universal KeyStore (HUKS) can be imported by applications or generated by calling the HUKS APIs.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The **HUKS** module provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations.
The keys managed by OpenHarmony Universal KeyStore (HUKS) can be imported by applications or generated by calling the HUKS APIs.
## Modules to Import
```js
......@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
| callback | AsyncCallback\<void> | Yes | Callback that returns no value.|
**Example**
......@@ -186,7 +186,7 @@ Deletes a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Key alias passed in when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
| callback | AsyncCallback\<void> | Yes | Callback that returns no value.|
**Example**
......@@ -289,7 +289,7 @@ Imports a key in plaintext. This API uses an asynchronous callback to return the
| -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
| callback | AsyncCallback\<void> | Yes | Callback that returns no value.|
**Example**
......@@ -553,7 +553,7 @@ Obtains the certificate used to verify a key. This API uses a promise to return
| Type | Description |
| ---------------------------------------------- | --------------------------------------------- |
| Promise<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If **err** is not returned, the operation is successful. Otherwise, an error occurs.|
| Promise<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example**
......@@ -676,7 +676,7 @@ Imports a wrapped key. This API uses an asynchronous callback to return the resu
| keyAlias | string | Yes | Alias of the wrapped key to import. |
| wrappingKeyAlias | string | Yes | Alias of the data used to unwrap the key imported. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and the wrapped key to import.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
| callback | AsyncCallback\<void> | Yes | Callback that returns no value.|
**Example**
......@@ -926,7 +926,7 @@ Exports a key. This API uses an asynchronous callback to return the result.
| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult)> | Yes | Callback invoked to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs. **outData** contains the public key exported.|
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. |
**Example**
......@@ -968,7 +968,7 @@ Exports a key. This API uses a promise to return the result.
| Type | Description |
| ---------------------------------------------- | ------------------------------------------------------------ |
| Promise<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If **err** is not returned, the operation is successful. Otherwise, an error occurs. **outData** contains the public key exported.|
| Promise<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If the operation is successful, no **err** value is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. |
**Example**
......@@ -1005,7 +1005,7 @@ Obtains key properties. This API uses an asynchronous callback to return the res
| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult)> | Yes | Callback invoked to return the result. If **errorCode** is **HUKS_SUCCESS**, the operation is successful. Otherwise, an error occurs.|
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult)> | Yes | Callback invoked to return the result. If the operation is successful, **errorCode** is **HUKS_SUCCESS**; otherwise, an error code is returned.|
**Example**
......@@ -1047,7 +1047,7 @@ Obtains key properties. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------------------- | ------------------------------------------------------------ |
| Promise\<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If **err** is not returned, the operation is successful. Otherwise, an error occurs. **properties** returns the parameters required for generating the key.|
| Promise\<[HuksReturnResult](#huksreturnresult)> | Promise used to return the result. If the operation is successful, no **err** value is returned and **properties** contains the parameters required for generating the key. If the operation fails, an error code is returned. |
**Example**
......@@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th
| -------- | --------------------------- | ---- | --------------------------------------- |
| keyAlias | string | Yes | Alias of the key to check. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists, and **FALSE** means the opposite.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
......@@ -1126,7 +1126,7 @@ Checks whether a key exists. This API uses a promise to return the result.
| Type | Description |
| ----------------- | --------------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **TRUE** means that the key exists, and **FALSE** means the opposite.|
| Promise\<boolean> | Promise used to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
......@@ -1315,7 +1315,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| -------- | --------------------------- | ---- | ------------------------------------------- |
| handle | number | Yes | Handle of the **Abort** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result.|
| callback | AsyncCallback\<void> | Yes | Callback that returns no value.|
**Example**
......@@ -1465,7 +1465,7 @@ Aborts the use of the key. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
| Promise\<void> | Promise used to return the result.|
| Promise\<void> | Promise that returns no value.|
**Example**
......@@ -1993,7 +1993,7 @@ Generates a key. This API uses an asynchronous callback to return the result.
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. |
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. For details about other results, see HuksResult.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code defined in **HuksResult** is returned.|
**Example**
......@@ -2050,7 +2050,7 @@ Generates a key. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code is returned.|
**Example**
......@@ -2099,7 +2099,7 @@ Deletes a key. This API uses an asynchronous callback to return the result.
| -------- | ----------------------------------------- | ---- | -------------------------------------------------- |
| keyAlias | string | Yes | Key alias passed in when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code is returned.|
**Example**
......@@ -2133,7 +2133,7 @@ Deletes a key. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code is returned.|
**Example**
......@@ -2163,7 +2163,7 @@ Imports a key in plaintext. This API uses an asynchronous callback to return the
| -------- | ------------------------ | ---- | ------------------------------------------------- |
| keyAlias | string | Yes | Alias of the key.|
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code is returned.|
**Example**
......@@ -2228,7 +2228,7 @@ Imports a key in plaintext. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned; otherwise, an error code is returned.|
**Example**
......@@ -2291,7 +2291,7 @@ Exports a key. This API uses an asynchronous callback to return the result.
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs. **outData** contains the public key exported.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.|
**Example**
......@@ -2325,7 +2325,7 @@ Exports a key. This API uses a promise to return the result.
| Type | Description |
| ----------------------------------- | ------------------------------------------------------------ |
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs. **outData** contains the public key exported.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. |
**Example**
......@@ -2355,7 +2355,7 @@ Obtains key properties. This API uses an asynchronous callback to return the res
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If **errorCode** is **HUKS_SUCCESS**, the operation is successful. Otherwise, an error occurs.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback invoked to return the result. If the operation is successful, **errorCode** is **HUKS_SUCCESS**; otherwise, an error code is returned.|
**Example**
......@@ -2389,7 +2389,7 @@ Obtains key properties. This API uses a promise to return the result.
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<[HuksResult](#huksoptions)> | Promise used to return the result. If **HUKS_SUCCESS** is returned, the operation is successful. Otherwise, an error occurs. **properties** returns the parameters required for generating the key.|
| Promise\<[HuksResult](#huksoptions)> | Promise used to return the result. If the operation is successful, **errorCode** is **HUKS_SUCCESS** and **properties** contains the parameters required for generating the key. If the operation fails, an error code is returned. |
**Example**
......@@ -2419,7 +2419,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th
| -------- | ---------------------- | ---- | ------------------------------------- |
| keyAlias | string | Yes | Alias of the key to check.|
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty).|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists, and **FALSE** means the opposite.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
......@@ -2453,7 +2453,7 @@ Checks whether a key exists. This API uses a promise to return the result.
| Type | Description |
| ----------------- | --------------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **TRUE** means that the key exists, and **FALSE** means the opposite.|
| Promise\<boolean> | Promise used to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
......
# RDB Error Codes
## 14800010 Invalid RDB Name
**Error Message**
Invalid database name.
**Description**
The RDB store name is invalid.
**Possible Causes**
The RDB store name is empty or exceeds 1024 bytes.
**Solution**
Check that the RDB store name is not empty and does not exceed 1024 bytes.
## 14800011 Database File Corrupted
**Error Message**
Database corrupted.
**Description**
The RDB store is corrupted when an API for adding, deleting, querying, or synchronizing data is invoked.
**Possible Causes**
The RDB store file has been corrupted.
**Solution**
1. Restore the RDB store using the backup file.
2. If no RDB backup file is available, delete the RDB store and create it again.
## 14800012 Empty Result Set or Invalid Position
**Error Message**
The result set is empty or the specified location is invalid.
**Description**
The result set is empty or the specified location is invalid.
**Possible Causes**
The result set is empty, or the specified row number in the result set is out of range [0, m - 1]. **m** is **resultsetV9.rowCount**.
**Solution**
Check whether the result set is empty or whether the specified row number is out of range.
## 14800013 Null Column Value or Column Data Type Incompatible With the API Called
**Error Message**
The column value is null or the column type is incompatible.
**Description**
The column value is null, or the column data type is incompatible with the API called.
**Possible Causes**
1. The result set is empty.
2. The current row number in the result set is out of range [0, m - 1]. **m** is **resultsetV9.rowCount**.
3. The column number is out of the range [0, n - 1]. **n** is **resultsetV9.columnCount**.
4. The API called does not support the type of the column data.
**Solution**
1. Check whether the result set is empty.
2. Check whether the row number and column number of the result set are out of range.
3. Check whether the column data type is supported.
# Preferences Error Codes
## 15500010 Failed to Delete Preferences
**Error Message**
Failed to delete preferences.
**Description**
Failed to delete the preference.
**Possible Causes**
The possible causes are as follows:
1. The file name is incorrect.
2. The file path is incorrect.
**Solution**
1. Check that the file name is correct.
2. Check that the file path is correct.
# Kernel
- Kernel
- Mini-System Kernel
- [Kernel Overview](kernel-overview.md)
- Mini-System Kernel (LiteOS-M)
- [LiteOS-M Overview](kernel-mini-overview.md)
- Basic Kernel
- Base Kernel
- [Interrupt Management](kernel-mini-basic-interrupt.md)
- [Task Management](kernel-mini-basic-task.md)
- [Memory Management](kernel-mini-basic-memory.md)
......@@ -16,6 +15,7 @@
- [Semaphore](kernel-mini-basic-ipc-sem.md)
- [Time Management](kernel-basic-mini-time.md)
- [Software Timer](kernel-mini-basic-soft.md)
- [Doubly Linked List](kernel-mini-basic-list.md)
- Extended Components
- [C++ Support](kernel-mini-extend-support.md)
- [CPUP](kernel-mini-extend-cpup.md)
......@@ -28,7 +28,6 @@
- [LMS](kernel-mini-memory-lms.md)
- Appendix
- [Kernel Coding Specification](kernel-mini-appx-code.md)
- [Doubly Linked List](kernel-mini-appx-data-list.md)
- [Standard Libraries](kernel-mini-appx-lib.md)
- Small-System Kernel (LiteOS-A)
- [Kernel Overview](kernel-small-overview.md)
......@@ -158,6 +157,7 @@
- [Compiling and Building the Linux Kernel](kernel-standard-build.md)
- Enhanced Kernel Features
- [Enhanced Swap](kernel-standard-mm-eswap.md)
- [NewIP Kernel Protocol Stack](kernel-standard-newip.md)
- Task Scheduling
- [Related Thread Group](kernel-standard-sched-rtg.md)
- [Lightweight CPU Isolation](kernel-standard-sched-cpuisolation.md)
\ No newline at end of file
# New IP Kernel Protocol Stack
## Basic Concepts
On basis of the traditional IP, New IP employs lightweight packet headers and variable-length, multi-semantic addresses and integrates Layer 2 and Layer 3 protocols to simplify protocols, reduce redundant bytes, and improve the energy efficiency ratio (EER), net throughput, and communication efficiency. New IP strives to implement end-to-end interconnection between heterogeneous networks to support ultimate experience of Super Device via efficient communication between devices.
The WiFi protocol packets cause low transmission efficiency due to high overheads in Layer 3 packet headers and addressing.
![](figures/newip-wifi-packet.png)
```
An IPv4 address has a fixed length of 4 bytes, and an IPv6 address has a fixed length of 16 bytes.
The network layer header ranges from 20 to 60 bytes for an IPv4 packet and is 40 bytes for an IPv6 packet.
```
New IP supports variable-length multi-semantic addresses (min. 1 byte) and customized header encapsulation (min. 5 bytes). Simplified packet headers reduce overheads and improve transmission efficiency.
New IP provides 25.9% less packet header overheads than IPv4 and 44.9% less than IPv6.
New IP provides at least 1% higher payload transmission efficiency than IPv4 and 2.33% than IPv6.
| Scenario | Header Overhead (Bytes) | Payload Transmission Efficiency<br>(WiFi MTU = 1500 Bytes, BT MTU = 255 Bytes)|
| -------------- | ------------ | ------------------------------------------- |
| IPv4 for WiFi | 30 + 8 + 20 = 58 | (1500 - 58)/1500 = 96.13% |
| IPv6 for WiFi | 30 + 8 + 40 = 78 | (1500 - 78)/1500 = 94.8% |
| NewIP for WiFi | 30 + 8 + 5 = 43 | (1500 - 43)/1500 = 97.13% |
## Variable-Length Header Format
The figure below shows a New IP WiFi packet header. "EtherType = 0xEADD" in the LLC header identifies the packet. **Bitmap** is a binary sequence. The value of each binary bit indicates the existence of a feature.
![](figures/newip-header.png)
- **Dispatch** indicates the encapsulation type. The value **0b0** indicates the New IP encapsulation child class, which is 1 bit long (**0b** indicates that the following values are binary).
- **Bitmap** is of variable length. By default, it is seven bits following the **Dispatch** valid bit. The length of **Bitmap** can be extended contiguously. The last bit **0** of **Bitmap** indicates the end of **Bitmap**. The last bit **1** means to extend the **Bitmap** one byte until the last bit **0**.
- **Value** indicates the field value. The length is an integer multiple of 1 byte. The value type and length are determined by the semantic table of the header field.
The **Bitmap** field is defined as follows:
| Bitmap Identifier | Bitops | Field Length (Byte) | Setting | Remarks |
| -------------------------- | ------ | ---------------- | -------------- | --------------------------------------- |
| Bitmap 1st Byte: | - | - | - | - |
| Dispatch flag | 0 | It does not indicate a specific field. | Set to **0**. | The value **0** indicates a New IP packet; **1** indicates a non-New-IP packet. |
| TTL | 1 | 1 | Set to **1**. | Indicates the number of remaining hops. |
| Total Length | 2 | 2 | Set to **0** for UDP and **1** for TCP.| Total length of a New IP packet (including the header length). |
| Next Header | 3 | 1 | Set to **1**. | Protocol type. |
| Reserve | 4 | Reserved | Set to **0**. | Reserved. |
| Dest Address | 5 | Variable length (1 to 8 bytes)| Set to **1**. | Destination address. |
| Source Address | 6 | Variable length (1 to 8 bytes)| Determined by the protocol.| Source address. |
| Flag bit, indicating whether there is the second byte| 7 | It does not indicate a specific field. | - | The value **0** indicates the end of this bitmap. The value **1** indicates another 8-bit bitmap.|
| Bitmap 2nd Byte: | - | - | - | - |
| Header Length | 0 | 1 | - | Length of the New IP packet header. |
| Reserve | 1 | Reserved | Set to **0**. | - |
| Reserve | 2 | Reserved | Set to **0**. | - |
| Reserve | 3 | Reserved | Set to **0**. | - |
| Reserve | 4 | Reserved | Set to **0**. | - |
| Reserve | 5 | Reserved | Set to **0**. | - |
| Reserve | 6 | Reserved | Set to **0**. | - |
| Flag bit, indicating whether there is the third byte| 7 | It does not indicate a specific field. | Set to **0**. | The value **0** indicates the end of this bitmap. The value **1** indicates another 8-bit bitmap.|
The bitmap fields in New IP are processed as follows:
Only the bitmap fields defined in New IP are parsed. All the bitmap fields with unknown semantics are skipped. The start position of the packet is located for parsing based on the header length. If the packet header contains bitmap fields with unknown semantics and does not contain the header length, the packet will be discarded.
## Variable-Length Address Format
New IP uses variable-length addresses. The address itself indicates the length of the address. The address encoding format is as follows:
| First Byte | Semantics | Valid Range of Address |
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| 0x00 | Address is 0 | [1 byte] 0 to 220 (0x00 to 0xDC) |
| 0x01 | Address is 1 | - |
| 0x02 | Address is 2 | - |
| ... | ... | - |
| 0xDC | Address is 220 | - |
| 0xDD | An 16-bit address, which is 0 + 256 * (0xDD - 0xDD) + the last byte value | [2 bytes] 221 to 255 (0x**DD**DD to 0x**DD**FF) |
| 0xDE | An 16-bit address, which is 0 + 256 * (0xDE - 0xDD) + the last byte value | [2 bytes] 256 to 511 (0x**DE**00 to 0x**DE**FF) |
| 0xDF | An 16-bit address, which is 0 + 256 * (0xDF - 0xDD) + the last byte value | [2 bytes] 512 to 767 (0x**DF**00 to 0x**DF**FF) |
| ... | ... | - |
| 0xF0 | An 16-bit address, which is 0 + 256 * (0xF0 - 0xDD) + the last byte value | [2 bytes] 4864 to 5119 (0x**F0**00 to 0x**F0**FF) |
| 0xF1 | An 16-bit address is followed | [3 bytes] 5120 to 65535 (0x**F1** 1400 to 0x**F1** FFFF) |
| 0xF2 | An 32-bit address is followed | [5 bytes] 65536 to 4,294,967,295 (0x**F2** 0001 0000 to 0x**F2** FFFF FFFF)|
| 0xF3 | An 48-bit address is followed | [7 bytes] 4,294,967,296 to 281,474,976,710,655 (0x**F3** 0001 0000 0000 to 0x**F3** FFFF FFFF FFFF)|
| 0xFE | An 56-bit address is followed | [8 bytes] 0 to 72,057,594,037,927,935 (0x**FE**00 0000 0000 0000 to 0x**FE**FF FFFF FFFF FFFF)|
## New IP Configuration
Configure related settings and dependencies during kernel compilation to enable New IP. The New IP configuration is as follows:
```c
CONFIG_NEWIP=y // Enable the New IP kernel protocol stack.
CONFIG_NEWIP_HOOKS=y // Enable New IP processing with hooks.
```
Set the following dependency:
```c
VENDOR_HOOKS=y // Enable the kernel function hooking framework.
```
**NOTE**
- Only the Linux 5.10 kernel supports the New IP kernel protocol stack.
- All native kernel code must be intrusively modified by hooks.
```c
/* Register the New IP ehash function with the kernel. */
register_trace_ninet_ehashfn_hook(&ninet_ehashfn_hook, NULL);
/* The following is the general entry function of IPv4 and IPv6 protocol stacks. Add the processing related to the New IP protocol stack to the general entry function. */
static u32 sk_ehashfn(const struct sock *sk)
{
/* IPv6 */
#if IS_ENABLED(CONFIG_IPV6)
if (sk->sk_family == AF_INET6 &&
!ipv6_addr_v4mapped(&sk->sk_v6_daddr))
return inet6_ehashfn(sock_net(sk),
&sk->sk_v6_rcv_saddr, sk->sk_num,
&sk->sk_v6_daddr, sk->sk_dport);
#endif
#if IS_ENABLED(CONFIG_NEWIP_HOOKS)
if (sk->sk_family == AF_NINET) {
u32 ret = 0;
/* ehash function registered by New IP */
trace_ninet_ehashfn_hook(sock_net(sk), &sk->sk_nip_rcv_saddr, sk->sk_num,
&sk->sk_nip_daddr, sk->sk_dport, &ret);
return ret;
}
#endif
/* IPv4 */
return inet_ehashfn(sock_net(sk),
sk->sk_rcv_saddr, sk->sk_num,
sk->sk_daddr, sk->sk_dport);
}
```
Run the following command to check whether the New IP protocol stack code is successfully enabled:
```c
find out/ -name *nip*.o
out/rk3568/obj/third_party/glib/glib/glib_source/guniprop.o
out/kernel/OBJ/linux-5.10/net/newip/nip_addrconf_core.o
out/kernel/OBJ/linux-5.10/net/newip/nip_hdr_decap.o
out/kernel/OBJ/linux-5.10/net/newip/nip_addr.o
out/kernel/OBJ/linux-5.10/net/newip/nip_checksum.o
out/kernel/OBJ/linux-5.10/net/newip/tcp_nip_output.o
...
```
Disable the New IP kernel protocol stack, delete **CONFIG_NEWIP** and the **out/kernel** directory, and start the build again.
```c
# CONFIG_NEWIP is not set
# CONFIG_NEWIP_HOOKS is not set
```
## New IP APIs
The user-mode application calls the socket API to create a New IP socket and uses the New IP frame header encapsulation to receive and transmit packets. The following table lists the New IP socket functions.
| Function | Input | Output | Return Value | Function Description |
| -------- | ------------------------------------------------------------ | ---------------------------------------------- | ---------------- | ------------------------------------------------------------ |
| socket | int **domain**, int type, int **protocol** | NA | Socket handle **sockfd**.| Creates a **socket** instance for New IP.<br> **domain** must be **AF_NINET**, which indicates a New IP socket.<br>**protocol** can be **IPPROTO_TCP** or **IPPROTO_UDP**.<br>This function returns the handle of the **socket** instance created.|
| bind | int sockfd, const **struct sockaddr_nin** *myaddr, socklen_t addrlen | NA | Error code. The value is an integer. | Binds the **socket** instance to the specified IP address and port.<br> **myaddr->sin_family** must be **AF_NINET**.|
| listen | int socket, int backlog | NA | Error code. The value is an integer. | Listens for the New IP address and port from the server. |
| connect | int sockfd, const **struct sockaddr_nin** *addr, aocklen_t addrlen | NA | Error code. The value is an integer. | Sets up a connection between the client and the server. |
| accept | int sockfd, **struct sockaddr_nin** *address, socklen_t *address_len | NA | **sockfd**. | Accepts the connection request from the client. |
| send | int sockfd, const void *msg, int len, unsigned int flags, const **struct sockaddr_nin** *dst_addr, int addrlen | NA | Error code. The value is an integer. | Sends New IP TCP packets from the socket. |
| recv | int sockfd, size_t len, int flags, **struct sockaddr_nin** *src_addr, | void **buf, int* *fromlen | Error code. The value is an integer. | Receives New IP TCP packets from the socket. |
| close | int sockfd | NA | Error code. The value is an integer. | Closes the socket to release resources. |
| ioctl | int sockfd, unsigned long cmd, ... | NA | Error code. The value is an integer. | Queries or modifies the information about the New IP protocol stack. |
| sendto | int sockfd, const void *msg, int len, unsigned int flags, const **struct sockaddr** *dst_addr, int addrlen | NA | Error code. The value is an integer. | Sends New IP UDP packets from the socket. |
| recvfrom | int sockfd, size_t len, int flags, | void *buf, struct sockaddr *from, int *fromlen | Error code. The value is an integer. | Receives New IP UDP packets from the socket. |
Structure of New IP short addresses:
```c
enum nip_8bit_addr_index {
NIP_8BIT_ADDR_INDEX_0 = 0,
NIP_8BIT_ADDR_INDEX_1 = 1,
NIP_8BIT_ADDR_INDEX_2 = 2,
NIP_8BIT_ADDR_INDEX_3 = 3,
NIP_8BIT_ADDR_INDEX_4 = 4,
NIP_8BIT_ADDR_INDEX_5 = 5,
NIP_8BIT_ADDR_INDEX_6 = 6,
NIP_8BIT_ADDR_INDEX_7 = 7,
NIP_8BIT_ADDR_INDEX_MAX,
};
enum nip_16bit_addr_index {
NIP_16BIT_ADDR_INDEX_0 = 0,
NIP_16BIT_ADDR_INDEX_1 = 1,
NIP_16BIT_ADDR_INDEX_2 = 2,
NIP_16BIT_ADDR_INDEX_3 = 3,
NIP_16BIT_ADDR_INDEX_MAX,
};
enum nip_32bit_addr_index {
NIP_32BIT_ADDR_INDEX_0 = 0,
NIP_32BIT_ADDR_INDEX_1 = 1,
NIP_32BIT_ADDR_INDEX_MAX,
};
#define nip_addr_field8 v.u.field8
#define nip_addr_field16 v.u.field16
#define nip_addr_field32 v.u.field32
#pragma pack(1)
struct nip_addr_field {
union {
unsigned char field8[NIP_8BIT_ADDR_INDEX_MAX];
unsigned short field16[NIP_16BIT_ADDR_INDEX_MAX]; /* big-endian */
unsigned int field32[NIP_32BIT_ADDR_INDEX_MAX]; /* big-endian */
} u;
};
struct nip_addr {
unsigned char bitlen; /* The address length is in bit (not byte) */
struct nip_addr_field v;
};
#pragma pack()
/* The following structure must be larger than V4. System calls use V4.
* If the definition is smaller than V4, the read process will have memory overruns
* v4: include\linux\socket.h --> sockaddr (16Byte)
*/
#define POD_SOCKADDR_SIZE 3
struct sockaddr_nin {
unsigned short sin_family; /* [2Byte] AF_NINET */
unsigned short sin_port; /* [2Byte] Transport layer port, big-endian */
struct nip_addr sin_addr; /* [9Byte] NIP address */
unsigned char sin_zero[POD_SOCKADDR_SIZE]; /* [3Byte] Byte alignment */
};
```
## New IP Development
Only the OpenHarmony Linux-5.10 kernel supports New IP kernel protocol stack. You must manually configure IP address and route data for New IP in user mode, and connect the two devices through the router WiFi. To implement automatic switch to the New IP kernel protocol stack for communication after the IP address and route are is configured, see the description in the blue block in the figure below.
![](figures/newip-development.png)
For details about the address and route configuration, see [examples](https://gitee.com/openharmony/communication_sfc_newip/tree/master/examples). Modify the CC definition in Makefile based on the CPU you use, compile the CC definition into a binary file, and push the file to the development board. Refer to the figure above to configure the address and route data for New IP.
| File | Description |
| ------------------ | ------------------------------------------------------ |
| nip_addr.c | Demo code for configuring the variable-length New IP addresses (any valid New IP address can be configured)|
| nip_route.c | Demo code for configuring the New IP route data (any valid New IP route can be configured) |
| check_nip_enable.c | Demo code for obtaining the New IP capabilities of the local device. |
Check the New IP address and route information on device 1.
```sh
# cat /proc/net/nip_addr
01 wlan0
# cat /proc/net/nip_route
02 ff09 1 wlan0 # Route to device 2.
01 01 2149580801 wlan0 # Route for sending packets to itself and receiving the packets.
```
Check the New IP address and route information on device 2.
```sh
# cat /proc/net/nip_addr
02 wlan0
# cat /proc/net/nip_route
01 ff09 1 wlan0 # Route to device 1.
02 02 2149580801 wlan0 # Route for sending packets to itself and receiving the packets.
```
## New IP Sample Code for Receiving and Sending Packets
The table below lists the demo code files. For details about how to use the user-mode APIs of the New IP protocol stack, see [examples](https://gitee.com/openharmony/communication_sfc_newip/tree/master/examples). Fixed addresses and routes are configured in the demo code. You do not need to manually specify the addresses and routes when executing the binary program.
| File | Description |
| --------------------- | ----------------------------- |
| nip_addr_cfg_demo.c | Demo code for configuring the New IP variable-length addresses. |
| nip_route_cfg_demo.c | Demo code for New IP route configuration. |
| nip_udp_server_demo.c | Demo code for the server that sends and receives New IP UDP packets.|
| nip_udp_client_demo.c | Demo code for the client that sends and receives New IP UDP packets.|
| nip_tcp_server_demo.c | Demo code for the server that sends and receives New IP TCP packets.|
| nip_tcp_client_demo.c | Demo code for the client that sends and receives New IP TCP packets.|
| nip_lib.c | API demo code, for example, obtaining the interface index.|
**Basic Procedure**
![](figures/newip-connections.png)
1. Copy the demo code to the Linux compiler, and run **make clean** and **make all** to compile the demo code.
2. Upload the generated binary files to device 1 and device 2.
3. Run the **ifconfig wlan0 up** command to start the network adapter.
4. Run the **./nip_addr_cfg_demo server** command on shell of device 1 to configure a variable-length address **0xDE00** (2 bytes) for the server. Run the **./nip_addr_cfg_demo client** command on device 2 to configure a variable-length address **0x50** (1 byte) for the client. Then, run the **cat /proc/net/nip_addr** command to check the kernel address configuration.
5. Run the **./nip_route_cfg_demo server** command on device 1 to configure the server route data. Run the **./nip_route_cfg_demo client** command on device 2 to configure the client route data. Then, run the **cat /proc/net/nip_route** command to check the kernel route configuration.
Now, you can send and receive UDP/TCP packets. By default, the addresses and routes configured are used for sending and receiving packets.
**Sending and Receiving UDP Packets**
Run the **./nip_udp_server_demo** command on the server and then the **./nip_udp_client_demo** command on the client. The client sends 10 New IP packets. After receiving the packets, the server sends them to the client.
```
The following information is displayed in the shell window on the server:
Received -- 1661826989 498038 NIP_UDP # 0 -- from 0x50:57605
Sending -- 1661826989 498038 NIP_UDP # 0 -- to 0x50:57605
Received -- 1661826990 14641 NIP_UDP # 1 -- from 0x50:57605
Sending -- 1661826990 14641 NIP_UDP # 1 -- to 0x50:57605
Received -- 1661826990 518388 NIP_UDP # 2 -- from 0x50:57605
Sending -- 1661826990 518388 NIP_UDP # 2 -- to 0x50:57605
...
Received -- 1661827011 590576 NIP_UDP # 9 -- from 0x50:37758
Sending -- 1661827011 590576 NIP_UDP # 9 -- to 0x50:37758
The following information is displayed in the shell window on the client:
Received --1661827007 55221 NIP_UDP # 0 sock 3 success: 1/ 1/no= 0
Received --1661827007 557926 NIP_UDP # 1 sock 3 success: 2/ 2/no= 1
Received --1661827008 62653 NIP_UDP # 2 sock 3 success: 3/ 3/no= 2
...
Received --1661827011 590576 NIP_UDP # 9 sock 3 success: 10/ 10/no= 9
```
**Sending and Receiving TCP Packets**
Run the **./nip_tcp_server_demo** command on the server and then the **./nip_tcp_client_demo** command on the client. The client sends 10 New IP packets. After receiving the packets, the server sends them to the client.
```
The following information is displayed in the shell window on the server:
Received -- 1661760202 560605 NIP_TCP # 0 --:1024
Sending -- 1661760202 560605 NIP_TCP # 0 --:1024
Received -- 1661760203 69254 NIP_TCP # 1 --:1024
Sending -- 1661760203 69254 NIP_TCP # 1 --:1024
Received -- 1661760203 571604 NIP_TCP # 2 --:1024
Sending -- 1661760203 571604 NIP_TCP # 2 --:1024
...
Received -- 1661760207 86544 NIP_TCP # 9 --:1024
Sending -- 1661760207 86544 NIP_TCP # 9 --:1024
The following information is displayed in the shell window on the client:
Received --1661760202 560605 NIP_TCP # 0 sock 3 success: 1/ 1/no= 0
Received --1661760203 69254 NIP_TCP # 1 sock 3 success: 2/ 2/no= 1
...
Received --1661760207 86544 NIP_TCP # 9 sock 3 success: 10/ 10/no= 9
```
## SELinux Policy
The SELinux policy must be added for the user-mode process to use New IP sockets. Otherwise, the operation will be intercepted.
```sh
# base\security\selinux\sepolicy\ohos_policy\xxx\xxx.te
# socket operation
# avc: denied { create } for pid=540 comm="thread_xxx" scontext=u:r:thread_xxx:s0 tcontext=u:r:thread_xxx:s0 tclass=socket permissive=0
allow thread_xxx thread_xxx:socket { create bind connect listen accept read write shutdown setopt getopt };
# ioctl operation
# The operation code is defined in linux-xxx\include\uapi\linux\sockios.h.
# 0x8933 : name -> if_index mapping
# 0x8916 : set PA address
# 0x890B : add routing table entry
allowxperm thread_xxx thread_xxx:socket ioctl { 0x8933 0x8916 0x890B };
```
## WireShark Packet Parsing Template
The default packet parsing rules of Wireshark cannot parse New IP packets. You can add a New IP packet parsing template to Wireshark to parse New IP packets. For details about the template, see [New IP packet parsing template](https://gitee.com/openharmony/communication_sfc_newip/blob/master/tools/wireshark_cfg_for_newip.lua).
The procedure is as follows:
Choose **Help** > **About Wireshark** > **Folders**, open the **Global Configuration** directory, and edit the **init.lua** file. Add **dofile (*DATA_DIR*.."newip.lua")** to the end of the file. *DATA_DIR* is the directory where the **newip.lua** plug-in is located.
![](figures/newip-WireShark-template.png)
The following is an example of adding a New IP packet parsing template:
```
Path of the New IP packet parsing template:
D:\tools\WireShark\wireshark_cfg_for_newip.lua
Path of the WireShark configuration file:
C:\Program Files\Wireshark\init.lua
Add the following to the end of the **init.lua** file (Windows 11, for example):
dofile("D:\\tools\\WireShark\\wireshark_cfg_for_newip.lua")
```
### Packet Parsing Example
#### ND Request
The figure below shows the format of the New IP Neighbor Discovery (ND) request packet. The header contains a 1-byte bitmap (0x76), which is followed by the TTL, total packet length, upper-layer protocol type, destination address, and source address. The New IP ND request packet contains the packet type, operation code, checksum, and request address.
![](figures/newip-ND-request.png)
![](figures/newip-ND-request-parsed.png)
#### ND Response
The figure below shows the format of a New IP ND response packet. The header contains two bitmaps (**0x77** and **0x00**). Bitmap 1 is followed by the TTL, total length of the packet, upper-layer protocol type, destination address, and source address. Bitmap2 is used for byte alignment and does not carry any data. (For the rk3568 development board, the data transmitted in the link layer must be of an even number of bytes.) A New IP ND response packet contains the packet type, operation code, checksum, neighbor MAC address length, and neighbor MAC address.
![](figures/newip-ND-response.png)
![](figures/newip-ND-response-parsed.png)
#### TCP Handshake
The figure below shows the format of a TCP three-way handshake SYN packet. The New IP packet header contains two bitmaps (**0x77** and **0x00**). Bitmap1 is followed by the TTL, total packet length, upper-layer protocol type, destination address, and source address. Bitmap2 is used for byte alignment and does not carry any data. (For the rk3568 development board, the data transmitted in the link layer must be of an even number of bytes.)
![](figures/newip-TCP-handshake.png)
![](figures/newip-TCP-handshake-parsed.png)
#### TCP Data Packet
The figure below shows the TCP data format. The New IP header contains two bitmaps (**0x77** and **0x00**). Bitmap 1 is followed by the TTL, total packet length, upper-layer protocol type, destination address, and source address. Bitmap2 is used for byte alignment and does not carry any data. (For the rk3568 development board, the data transmitted in the link layer must be of an even number of bytes.)
![](figures/newip-TCP-packet.png)
![](figures/newip-TCP-packet-parsed.png)
......@@ -44,6 +44,7 @@
- [设备使用信息统计](device-usage-statistics/Readme-CN.md)
- [DFX](dfx/Readme-CN.md)
- [国际化](internationalization/Readme-CN.md)
- [应用测试](application-test/Readme-CN.md)
- [一次开发,多端部署](key-features/multi-device-app-dev/Readme-CN.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/Readme-CN.md)
......@@ -65,4 +66,3 @@
- [常见问题](faqs/Readme-CN.md)
- 贡献
- [参与贡献](../contribute/贡献文档.md)
......@@ -37,6 +37,7 @@
- [设备使用信息统计](device-usage-statistics/Readme-CN.md)
- [DFX](dfx/Readme-CN.md)
- [国际化](internationalization/Readme-CN.md)
- [应用测试](application-test/Readme-CN.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/Readme-CN.md)
......
......@@ -37,6 +37,7 @@
- [设备使用信息统计](device-usage-statistics/device-usage-statistics-overview.md)
- [DFX](dfx/hiappevent-overview.md)
- [国际化](internationalization/international-overview.md)
- [应用测试](application-test/Readme-CN.md)
- [IDL工具规格及使用说明书](IDL/idl-guidelines.md)
- [Native API的相关指导](napi/napi-guidelines.md)
......
......@@ -13,7 +13,7 @@
- 振动
- [振动开发概述](vibrator-overview.md)
- [振动开发指导](vibrator-guidelines.md)
- 设备管理
- 多模输入
- [输入设备开发指导](inputdevice-guidelines.md)
- [鼠标光标开发指导](pointerstyle-guidelines.md)
- 升级服务
......
......@@ -16,10 +16,10 @@ import inputDevice from '@ohos.multimodalInput.inputDevice';
| 实例名 | 接口名 | 说明 |
| ----------- | ------------------------------------------------------------ | -------------------------- |
| inputDevice | **function** getDeviceList(callback: AsyncCallback<Array<**number**>>): **void**; | 获取输入设备列表。 |
| inputDevice | **function** getKeyboardType(deviceId: **number**, callback: AsyncCallback<KeyboardType>): **void**; | 获取输入设备的键盘类型。 |
| inputDevice | **function** on(**type**: "change", listener: Callback<DeviceListener>): **void**; | 监听输入设备的热插拔事件。 |
| inputDevice | **function** off(**type**: "change", listener?: Callback<DeviceListener>): **void**; | 取消监听输入设备的热插拔事件。 |
| inputDevice | function getDeviceList(callback: AsyncCallback\<Array\<number>>): void; | 获取输入设备列表。 |
| inputDevice | function getKeyboardType(deviceId: number, callback: AsyncCallback\<KeyboardType>): void; | 获取输入设备的键盘类型。 |
| inputDevice | function on(type: "change", listener: Callback\<DeviceListener>): void; | 监听输入设备的热插拔事件。 |
| inputDevice | function off(type: "change", listener?: Callback\<DeviceListener>): void; | 取消监听输入设备的热插拔事件。 |
## 虚拟键盘弹出检测
......
......@@ -16,10 +16,10 @@ import inputDevice from '@ohos.multimodalInput.pointer';
| 实例名 | 接口名 | 说明 |
| ------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| pointer | **function** isPointerVisible(callback: AsyncCallback<boolean>): **void**; | 获取鼠标指针显示或隐藏状态。 |
| pointer | **function** setPointerVisible(visible: boolean, callback: AsyncCallback<**void**>): **void**; | 设置鼠标指针显示或隐藏状态,改接口会影响全局鼠标光标的显示状态。 |
| pointer | **function** setPointerStyle(windowId: **number**, pointerStyle: PointerStyle, callback: AsyncCallback<**void**>): **void**; | 设置鼠标光标样式,改接口会影响指定窗口鼠标光标样式。 |
| pointer | **function** getPointerStyle(windowId: **number**, callback: AsyncCallback<PointerStyle>): **void**; | 查询鼠标光标样式。 |
| pointer | function isPointerVisible(callback: AsyncCallback\<boolean>): void; | 获取鼠标指针显示或隐藏状态。 |
| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\<void>): void; | 设置鼠标指针显示或隐藏状态,改接口会影响全局鼠标光标的显示状态。 |
| pointer | function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\<void>): void; | 设置鼠标光标样式,改接口会影响指定窗口鼠标光标样式。 |
| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\<PointerStyle>): void; | 查询鼠标光标样式。 |
## 设置鼠标光标隐藏
......
......@@ -21,7 +21,7 @@ display.getDefaultDisplay((err, data) => {
});
```
## 如何获取当前运行设备类型(穿戴、平板等)
## 如何获取当前运行设备类型
适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型
......
......@@ -14,14 +14,14 @@
| 接口名 | 描述 |
|----------------------------------------------------------------------------------|-------------|
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession\>): void | 创建会话 |
| setAVMetadata(data: AVMetadata, callback: AsyncCallback<void\>): void | 设置会话元数据 |
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void\>): void | 设置会话播放状态信息 |
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void\>): void | 设置启动ability |
| getController(callback: AsyncCallback<AVSessionController\>): void | 获取当前会话自身控制器 |
| getOutputDevice(callback: AsyncCallback<OutputDeviceInfo\>): void | 获取音频输出设备信息 |
| activate(callback: AsyncCallback<void\>): void | 激活会话 |
| destroy(callback: AsyncCallback<void\>): void | 销毁会话 |
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\<AVSession>): void | 创建会话 |
| setAVMetadata(data: AVMetadata, callback: AsyncCallback\<void>): void | 设置会话元数据 |
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\<void>): void | 设置会话播放状态信息 |
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void | 设置启动ability |
| getController(callback: AsyncCallback\<AVSessionController>): void | 获取当前会话自身控制器 |
| getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void | 获取音频输出设备信息 |
| activate(callback: AsyncCallback\<void>): void | 激活会话 |
| destroy(callback: AsyncCallback\<void>): void | 销毁会话 |
### 开发步骤
1.导入模块接口
......@@ -354,14 +354,14 @@ currentSession.deactivate().then(() => {
| 接口名 | 描述 |
| ------------------------------------------------------------------------------------------------ | ----------------- |
| getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void | 获取所有会话的描述符 |
| createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void | 创建控制器 |
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void\>): void | 发送按键命令 |
| getLaunchAbility(callback: AsyncCallback<WantAgent\>): void | 拉起应用 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void\>): void | 发送控制命令 |
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void | 发送系统按键命令 |
| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void | 发送系统控制命令 |
| castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void | 远端投播 |
| getAllSessionDescriptors(callback: AsyncCallback\<Array\<Readonly\<AVSessionDescriptor>>>): void | 获取所有会话的描述符 |
| createController(sessionId: string, callback: AsyncCallback\<AVSessionController>): void | 创建控制器 |
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void | 发送按键命令 |
| getLaunchAbility(callback: AsyncCallback\<WantAgent>): void | 拉起应用 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void | 发送控制命令 |
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void | 发送系统按键命令 |
| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void | 发送系统控制命令 |
| castAudio(session: SessionToken | 'all', audioDevices: Array\<audio.AudioDeviceDescriptor>, callback: AsyncCallback\<void>): void | 远端投播 |
### 开发步骤
1.导入模块接口
......
......@@ -21,13 +21,18 @@ let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {
// 创建pixelmap对象
const color = new ArrayBuffer(96);
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } }
image.createPixelMap(color, opts, pixelmap => {
image.createPixelMap(color, opts, (err, pixelmap) => {
console.log('Succeeded in creating pixelmap.');
})
// 用于读像素
pixelmap.readPixels(area,(data) => {
if(data !== null) {
const area = {
pixels: new ArrayBuffer(8),
offset: 0,
stride: 8,
region: { size: { height: 1, width: 2 }, x: 0, y: 0 }
}
pixelmap.readPixels(area,() => {
var bufferArr = new Uint8Array(area.pixels);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
......@@ -40,7 +45,6 @@ pixelmap.readPixels(area,(data) => {
}
}
}
}
})
// 用于存像素
......@@ -128,7 +132,7 @@ imageSourceApi.release(() => {
const imagePackerApi = image.createImagePacker();
const imageSourceApi = image.createImageSource(0);
let packOpts = { format:"image/jpeg", quality:98 };
imagePackerApi.packing(imageSourceApi, packOpts, data => {
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.log('Succeeded in packing');
})
......@@ -156,7 +160,7 @@ let decodingOptions = {
};
// 用于回调方式创建pixelmap
imageSourceApi.createPixelMap(decodingOptions, pixelmap => {
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
console.log('Succeeded in creating pixelmap.');
})
......
......@@ -5,8 +5,8 @@
- [使用ArkTS语言开发(FA模型)](start-with-ets-fa.md)
- [使用JS语言开发(FA模型)](start-with-js-fa.md)
- 开发基础知识
- [应用包结构说明(FA模型)](package-structure.md)
- [应用包结构说明(Stage模型)](stage-structure.md)
- [应用包结构配置文件的说明(FA模型)](package-structure.md)
- [应用包结构配置文件的说明(Stage模型)](stage-structure.md)
- [SysCap说明](syscap.md)
- [资源分类与访问](resource-categories-and-access.md)
- 学习ArkTS语言
......
# 应用包结构配置文件的说明
# 应用包结构配置文件的说明(FA模型)
在FA模型的应用开发的工程中,需要在config.json配置文件中对应用的包结构进行声明。
......
# 应用包结构配置文件的说明
# 应用包结构配置文件的说明(Stage模型)
在开发stage模型的应用程序时,需要在app.json5和module.json5配置文件中对应用的包结构进行声明。
......
# 开发参考
- [Syscap列表](syscap-list.md)
- [组件参考(基于ArkTS的声明式开发范式)](arkui-ts/Readme-CN.md)
- [组件参考(兼容JS的类Web开发范式)](arkui-js/Readme-CN.md)
- [JS服务卡片UI组件参考](js-service-widget-ui/Readme-CN.md)
- [接口参考(JS及TS API)](apis/Readme-CN.md)
- [错误码参考](errorcodes/Readme-CN.md)
- 接口参考(Native API)
- [OpenHarmony Native API](native-apis/Readme-CN.md)
- [Native API标准库](native-lib/Readme-CN.md)
......@@ -36,6 +36,7 @@
- [@ohos.ability.dataUriUtils (DataUriUtils模块)](js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md)
- [@ohos.ability.wantConstant (wantConstant)](js-apis-ability-wantConstant.md)
- [@ohos.app.ability.appRecovery (appRecovery)](js-apis-app-ability-appRecovery.md)
- [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-abilityDelegatorRegistry.md)
- [@ohos.application.abilityManager (AbilityManager)](js-apis-application-abilityManager.md)
- [@ohos.application.appManager (appManager)](js-apis-appmanager.md)
......@@ -231,7 +232,6 @@
- [@ohos.batteryStatistics (耗电统计)](js-apis-batteryStatistics.md)
- [@ohos.brightness (屏幕亮度)](js-apis-brightness.md)
- [@ohos.deviceInfo (设备信息)](js-apis-device-info.md)
- [@ohos.devicestatus (设备状态感知框架)](js-apis-stationary.md)
- [@ohos.distributedHardware.deviceManager (设备管理)](js-apis-device-manager.md)
- [@ohos.geoLocationManager (位置服务)](js-apis-geoLocationManager.md)
- [@ohos.multimodalInput.inputConsumer (组合按键)](js-apis-inputconsumer.md)
......@@ -249,6 +249,7 @@
- [@ohos.runningLock (Runninglock锁)](js-apis-runninglock.md)
- [@ohos.sensor (传感器)](js-apis-sensor.md)
- [@ohos.settings (设置数据项名称)](js-apis-settings.md)
- [@ohos.stationary (设备状态感知框架)](js-apis-stationary.md)
- [@ohos.systemCapability (系统能力)](js-apis-system-capability.md)
- [@ohos.systemParameterV9 (系统属性)](js-apis-system-parameterV9.md)
- [@ohos.thermal (热管理)](js-apis-thermal.md)
......
......@@ -45,7 +45,7 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\<void>
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......@@ -91,7 +91,7 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\<vo
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......@@ -142,7 +142,7 @@ getDisposedStatus(appId: string): Promise\<Want>;
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......@@ -186,7 +186,7 @@ getDisposedStatus(appId: string, callback: AsyncCallback\<Want>): void;
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......@@ -236,7 +236,7 @@ deleteDisposedStatus(appId: string): Promise\<void>
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......@@ -280,7 +280,7 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\<void>) : void
| 错误码ID | 错误信息 |
| ------ | -------------------------------------- |
| 17700005 | The specified appId was not found. |
| 17700005 | The specified app ID is not found. |
**示例:**
......
......@@ -51,11 +51,6 @@ ArrayList的构造函数。
```ts
let arrayList = new ArrayList();
try {
let arrayList2 = ArrayList();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -89,21 +84,16 @@ add(element: T): boolean
**示例:**
```ts
let arrayList = new ArrayList();
let result = arrayList.add("a");
let result1 = arrayList.add(1);
let b = [1, 2, 3];
let result2 = arrayList.add(b);
let c = {name: "Dylon", age: "13"};
let result3 = arrayList.add(c);
let result4 = arrayList.add(false);
try {
arrayList.add.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
```ts
let arrayList = new ArrayList();
let result = arrayList.add("a");
let result1 = arrayList.add(1);
let b = [1, 2, 3];
let result2 = arrayList.add(b);
let c = {name: "Dylon", age: "13"};
let result3 = arrayList.add(c);
let result4 = arrayList.add(false);
```
### insert
......@@ -136,21 +126,6 @@ let arrayList = new ArrayList();
arrayList.insert("A", 0);
arrayList.insert(0, 1);
arrayList.insert(true, 2);
try {
arrayList.insert.bind({}, 1, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
let res = arrayList.insert(8, 11); // 测试越界异常
} catch (err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
let res = arrayList.insert("a", "b"); // 测试类型异常
} catch (err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### has
......@@ -188,11 +163,6 @@ let arrayList = new ArrayList();
let result = arrayList.has("squirrel");
arrayList.add("squirrel");
let result1 = arrayList.has("squirrel");
try {
arrayList.has.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getIndexOf
......@@ -235,11 +205,6 @@ arrayList.add(1);
arrayList.add(2);
arrayList.add(4);
let result = arrayList.getIndexOf(2);
try {
arrayList.getIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLastIndexOf
......@@ -282,11 +247,6 @@ arrayList.add(1);
arrayList.add(2);
arrayList.add(4);
let result = arrayList.getLastIndexOf(2);
try {
arrayList.getLastIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeByIndex
......@@ -328,21 +288,6 @@ arrayList.add(5);
arrayList.add(2);
arrayList.add(4);
let result = arrayList.removeByIndex(2);
try {
arrayList.removeByIndex.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
arrayList.removeByIndex("a"); // 测试类型异常
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
arrayList.removeByIndex(8); // 测试越界异常
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### remove
......@@ -382,11 +327,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
let result = arrayList.remove(2);
try {
arrayList.remove.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeByRange
......@@ -422,16 +362,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.removeByRange(2, 4);
try {
arrayList.removeByRange.bind({}, 2, 4)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
arrayList.removeByRange(8, 4); // 测试越界异常
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### replaceAllElements
......@@ -480,13 +410,6 @@ arrayList.replaceAllElements((value: number, index: number)=> {
arrayList.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
try {
arrayList.replaceAllElements.bind({}, (value: number, index: number)=> {
return value = 2 * value;
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -532,13 +455,6 @@ arrayList.add(4);
arrayList.forEach((value, index) => {
console.log(`value:${value}`, index);
});
try {
arrayList.forEach.bind({}, (value, index) => {
console.log(`value:${value}`, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### sort
......@@ -581,11 +497,6 @@ arrayList.add(4);
arrayList.sort((a: number, b: number) => a - b);
arrayList.sort((a: number, b: number) => b - a);
arrayList.sort();
try {
arrayList.sort.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### subArrayList
......@@ -629,16 +540,6 @@ arrayList.add(4);
let result1 = arrayList.subArrayList(2, 4);
let result2 = arrayList.subArrayList(4, 3);
let result3 = arrayList.subArrayList(2, 6);
try {
arrayList.subArrayList.bind({}, 2, 4)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
arrayList.subArrayList(6, 4);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clear
......@@ -666,11 +567,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.clear();
try {
arrayList.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clone
......@@ -705,11 +601,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
let result = arrayList.clone();
try {
arrayList.clone.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getCapacity
......@@ -743,11 +634,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
let result = arrayList.getCapacity();
try {
arrayList.getCapacity.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### convertToArray
......@@ -781,11 +667,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
let result = arrayList.convertToArray();
try {
arrayList.convertToArray.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### isEmpty
......@@ -819,11 +700,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
let result = arrayList.isEmpty();
try {
arrayList.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### increaseCapacityTo
......@@ -858,11 +734,6 @@ arrayList.add(5);
arrayList.add(4);
arrayList.increaseCapacityTo(2);
arrayList.increaseCapacityTo(8);
try {
arrayList.increaseCapacityTo.bind({}, 5)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### trimToCurrentLength
......@@ -890,11 +761,6 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.trimToCurrentLength();
try {
arrayList.trimToCurrentLength.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -940,9 +806,4 @@ while(temp != undefined) {
console.log(`value:${temp}`);
temp = iter.next().value;
}
try {
arrayList[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -2256,7 +2256,7 @@ console.info('######### CapturerChange Off is called #########');
isActive(volumeType: AudioVolumeType, callback: AsyncCallback&lt;boolean&gt;): void
获取指定音流是否为活跃状态,使用callback方式异步返回结果。
获取指定音流是否为活跃状态,使用callback方式异步返回结果。
**系统能力:** SystemCapability.Multimedia.Audio.Renderer
......@@ -2264,7 +2264,7 @@ isActive(volumeType: AudioVolumeType, callback: AsyncCallback&lt;boolean&gt;): v
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------- | ---- | ------------------------------------------------- |
| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音流类型。 |
| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音流类型。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调返回流的活跃状态,true为活跃,false为不活跃。 |
**示例:**
......@@ -2283,7 +2283,7 @@ audioStreamManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
isActive(volumeType: AudioVolumeType): Promise&lt;boolean&gt;
获取指定音流是否为活跃状态,使用Promise方式异步返回结果。
获取指定音流是否为活跃状态,使用Promise方式异步返回结果。
**系统能力:** SystemCapability.Multimedia.Audio.Renderer
......@@ -2291,7 +2291,7 @@ isActive(volumeType: AudioVolumeType): Promise&lt;boolean&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------- | ---- | ------------ |
| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音流类型。 |
| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音流类型。 |
**返回值:**
......
......@@ -59,24 +59,9 @@ import buffer from '@ohos.buffer';
import buffer from '@ohos.buffer';
let buf = buffer.from("1236");
try {
buf.length = 10;
} catch (err) {
console.log("set length exception: " + JSON.stringify(err));
}
let buf1 = buffer.from("123");
try {
buf.buffer = buf1;
} catch (err) {
console.log("set buffer exception: " + JSON.stringify(err));
}
try {
buf.byteOffset = 3;
} catch (err) {
console.log("set byteOffset exception: " + JSON.stringify(err));
}
console.log(buf.length);
console.log(buf.buffer);
console.log(buf.byteOffset);
```
### alloc
......@@ -109,12 +94,6 @@ import buffer from '@ohos.buffer';
let buf1 = buffer.alloc(5);
let buf2 = buffer.alloc(5, 'a');
let buf3 = buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
try {
let buf = buffer.alloc(-5);
} catch (err) {
console.log("alloc exception: " + JSON.stringify(err));
}
```
### allocUninitializedFromPool
......@@ -145,12 +124,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(10);
buf.fill(0);
try {
let buf = buffer.allocUninitializedFromPool(-5);
} catch (err) {
console.log("allocUninitializedFromPool exception: " + JSON.stringify(err));
}
```
### allocUninitialized
......@@ -180,12 +153,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitialized(10);
buf.fill(0);
try {
let buf = buffer.allocUninitialized(-5);
} catch (err) {
console.log("allocUninitialized exception: " + JSON.stringify(err));
}
```
### byteLength
......@@ -217,12 +184,6 @@ import buffer from '@ohos.buffer';
let str = '\u00bd + \u00bc = \u00be';
console.log(`${str}: ${str.length} characters, ${buffer.byteLength(str, 'utf-8')} bytes`);
// 打印: ½ + ¼ = ¾: 9 characters, 12 bytes
try {
let byteLen = buffer.byteLength(10);
} catch (err) {
console.log("byteLength exception: " + JSON.stringify(err));
}
```
### compare
......@@ -256,14 +217,7 @@ let buf1 = buffer.from('1234');
let buf2 = buffer.from('0123');
let res = buf1.compare(buf2);
console.log(Number(res).toString());
// 打印 1
try {
let res = buffer.compare(10, buf2);
} catch (err) {
console.log("compare exception: " + JSON.stringify(err));
}
console.log(Number(res).toString()); // 打印 1
```
### concat
......@@ -304,18 +258,6 @@ let buf1 = buffer.from("1234");
let buf2 = buffer.from("abcd");
let buf = buffer.concat([buf1, buf2]);
console.log(buf.toString('hex')); // 3132333461626364
try {
buf = buffer.concat("test string");
} catch (err) {
console.log("concat exception: " + JSON.stringify(err));
}
try {
buf = buffer.concat([buf1, buf2], -1);
} catch (err) {
console.log("concat exception: " + JSON.stringify(err));
}
```
### from
......@@ -345,12 +287,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
console.log(buf.toString('hex')); // 627566666572
try {
const buf = buffer.from(10);
} catch (err) {
console.log("from exception: " + JSON.stringify(err));
}
```
### from
......@@ -398,11 +334,6 @@ array[1] = '2';
array[2] = '3';
array[3] = '4';
array[4] = '5';
try {
const buf = buffer.from(arrayBuffer, 6, 1);
} catch (err) {
console.log("from exception: " + JSON.stringify(err));
}
```
### from
......@@ -432,12 +363,6 @@ import buffer from '@ohos.buffer';
let buf1 = buffer.from('buffer');
let buf2 = buffer.from(buf1);
try {
const buf = buffer.from(10);
} catch (err) {
console.log("from exception: " + JSON.stringify(err));
}
```
### from
......@@ -468,12 +393,6 @@ from(object: Object, offsetOrEncoding: number | string, length: number): Buffer
import buffer from '@ohos.buffer';
let buf = buffer.from(new String('this is a test'));
try {
const buf = buffer.from(10, 0, 1);
} catch (err) {
console.log("from exception: " + JSON.stringify(err));
}
```
### from
......@@ -507,12 +426,6 @@ let buf2 = buffer.from('7468697320697320612074c3a97374', 'hex');
console.log(buf1.toString()); // 打印: this is a test
console.log(buf2.toString());
try {
const buf = buffer.from("test string", "utf9");
} catch (err) {
console.log("from exception: " + JSON.stringify(err));
}
```
......@@ -614,13 +527,6 @@ let buf2 = buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
console.log(buf1.compare(buf2, 5, 9, 0, 4).toString()); // 打印: 0
console.log(buf1.compare(buf2, 0, 6, 4).toString()); // 打印: -1
console.log(buf1.compare(buf2, 5, 6, 5).toString()); // 打印: 1
let buf = buffer.from("1236");
try {
let res = buf.compare(10);
} catch (err) {
console.log("compare exception: " + JSON.stringify(err));
}
```
### copy
......@@ -669,21 +575,6 @@ for (let i = 0; i < 26; i++) {
buf1.copy(buf2, 8, 16, 20);
console.log(buf2.toString('ascii', 0, 25));
// 打印: !!!!!!!!qrst!!!!!!!!!!!!!
let buf3 = buffer.from("123656");
try {
let num = buf3.copy(10);
} catch (err) {
console.log("copy exception: " + JSON.stringify(err));
}
let buf4 = buffer.from("123656");
let buf5 = buffer.from("1235");
try {
let num = buf4.copy(buf5, -1);
} catch (err) {
console.log("copy exception: " + JSON.stringify(err));
}
```
### entries
......@@ -736,12 +627,6 @@ let buf3 = buffer.from('ABCD');
console.log(buf1.equals(buf2).toString()); // 打印: true
console.log(buf1.equals(buf3).toString()); // 打印: false
try {
let res = buf1.equals("1236");
} catch (err) {
console.log("equals exception: " + JSON.stringify(err));
}
```
### fill
......@@ -782,12 +667,6 @@ import buffer from '@ohos.buffer';
let b = buffer.allocUninitializedFromPool(50).fill('h');
console.log(b.toString());
try {
let buf = buffer.alloc(3).fill("$*$", -1);
} catch (err) {
console.log("fill exception: " + JSON.stringify(err));
}
```
......@@ -821,13 +700,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.from('this is a buffer');
console.log(buf.includes('this').toString()); // 打印: true
console.log(buf.includes('be').toString()); // 打印: false
let buf1 = buffer.from("13236");
try {
let flag = buf1.includes(true);
} catch (err) {
console.log("includes exception: " + JSON.stringify(err));
}
```
### indexOf
......@@ -860,19 +732,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.from('this is a buffer');
console.log(buf.indexOf('this').toString()); // 打印: 0
console.log(buf.indexOf('is').toString()); // 打印: 2
let buf1 = buffer.from("13236");
try {
let index = buf1.indexOf(true);
} catch (err) {
console.log("indexOf exception: " + JSON.stringify(err));
}
try {
let index1 = buf1.indexOf("a", "utf9");
} catch (err) {
console.log("indexOf exception: " + JSON.stringify(err));
}
```
### keys
......@@ -930,20 +789,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.from('this buffer is a buffer');
console.log(buf.lastIndexOf('this').toString()); // 打印: 0
console.log(buf.lastIndexOf('buffer').toString()); // 打印: 17
let buf1 = buffer.from("13236");
try {
let index = buf1.lastIndexOf(true);
} catch (err) {
console.log("lastIndexOf exception: " + JSON.stringify(err));
}
try {
let index1 = buf1.lastIndexOf("a", "utf9");
} catch (err) {
console.log("lastIndexOf exception: " + JSON.stringify(err));
}
```
......@@ -986,11 +831,6 @@ console.log(buf.readBigInt64BE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeBigInt64BE(0x0102030405060708n, 0);
try {
let ref = buf1.readBigInt64BE(1).toString(16);
} catch (err) {
console.log("readBigInt64BE exception: " + JSON.stringify(err));
}
```
### readBigInt64LE
......@@ -1032,11 +872,6 @@ console.log(buf.readBigInt64LE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeBigInt64BE(0x0102030405060708n, 0);
try {
let ref = buf1.readBigInt64LE(1).toString(16);
} catch (err) {
console.log("readBigInt64LE exception: " + JSON.stringify(err));
}
```
### readBigUInt64BE
......@@ -1078,11 +913,6 @@ console.log(buf.readBigUInt64BE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeBigUInt64BE(0xdecafafecacefaden, 0);
try {
let ref = buf1.readBigUInt64BE(1).toString(16);
} catch (err) {
console.log("readBigUInt64BE exception: " + JSON.stringify(err));
}
```
### readBigUInt64LE
......@@ -1124,11 +954,6 @@ console.log(buf.readBigUInt64LE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeBigUInt64BE(0xdecafafecacefaden, 0);
try {
let ref = buf1.readBigUInt64LE(1).toString(16);
} catch (err) {
console.log("readBigUInt64LE exception: " + JSON.stringify(err));
}
```
### readDoubleBE
......@@ -1169,11 +994,6 @@ console.log(buf.readDoubleBE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeDoubleBE(123.456, 0);
try {
let ref = buf1.readDoubleBE(1);
} catch (err) {
console.log("readDoubleBE exception: " + JSON.stringify(err));
}
```
### readDoubleLE
......@@ -1214,11 +1034,6 @@ console.log(buf.readDoubleLE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(8);
buf1.writeDoubleLE(123.456, 0);
try {
let ref = buf1.readDoubleLE(1);
} catch (err) {
console.log("readDoubleLE exception: " + JSON.stringify(err));
}
```
### readFloatBE
......@@ -1259,11 +1074,6 @@ console.log(buf.readFloatBE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeFloatBE(0xcabcbcbc, 0);
try {
let ref = buf1.readFloatBE(1).toString(16);
} catch (err) {
console.log("readFloatBE exception: " + JSON.stringify(err));
}
```
### readFloatLE
......@@ -1304,11 +1114,6 @@ console.log(buf.readFloatLE(0).toString());
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeFloatLE(0xcabcbcbc, 0);
try {
let ref = buf1.readFloatLE(1).toString(16);
} catch (err) {
console.log("readFloatLE exception: " + JSON.stringify(err));
}
```
### readInt8
......@@ -1350,11 +1155,6 @@ console.log(buf.readInt8(1).toString()); // 打印: 5
let buf1 = buffer.allocUninitializedFromPool(2);
buf1.writeInt8(0x12);
try {
let ref = buf1.readInt8(2).toString(16);
} catch (err) {
console.log("readInt8 exception: " + JSON.stringify(err));
}
```
### readInt16BE
......@@ -1395,11 +1195,6 @@ console.log(buf.readInt16BE(0).toString()); // 打印: 5
let buf1 = buffer.alloc(2);
buf1.writeInt16BE(0x1234, 0);
try {
let ref = buf1.readInt16BE(1).toString(16);
} catch (err) {
console.log("readInt16BE exception: " + JSON.stringify(err));
}
```
### readInt16LE
......@@ -1440,11 +1235,6 @@ console.log(buf.readInt16LE(0).toString()); // 打印: 1280
let buf1 = buffer.alloc(2);
buf1.writeInt16BE(0x1234, 0);
try {
let ref = buf1.readInt16LE(1);
} catch (err) {
console.log("readInt16LE exception: " + JSON.stringify(err));
}
```
### readInt32BE
......@@ -1485,11 +1275,6 @@ console.log(buf.readInt32BE(0).toString()); // 打印: 5
let buf1 = buffer.alloc(4);
buf1.writeInt32BE(0x12345678, 0);
try {
let ref = buf1.readInt32BE(1);
} catch (err) {
console.log("readInt32BE exception: " + JSON.stringify(err));
}
```
### readInt32LE
......@@ -1530,11 +1315,6 @@ console.log(buf.readInt32LE(0).toString()); // 打印: 83886080
let buf1 = buffer.alloc(4);
buf1.writeInt32BE(0x12345678, 0);
try {
let ref = buf1.readInt32LE(1);
} catch (err) {
console.log("readInt32LE exception: " + JSON.stringify(err));
}
```
### readIntBE
......@@ -1578,11 +1358,6 @@ console.log(num.toString()); // 97
let buf1 = buffer.allocUninitializedFromPool(6);
buf1.writeIntBE(0x123456789011, 0, 6);
try {
let ref = buf1.readIntBE(2, 5).toString(16);
} catch (err) {
console.log("readIntBE exception: " + JSON.stringify(err));
}
```
......@@ -1626,11 +1401,6 @@ console.log(buf.readIntLE(0, 6).toString(16));
let buf1 = buffer.allocUninitializedFromPool(6);
buf1.writeIntLE(0x123456789011, 0, 6);
try {
let ref = buf1.readIntLE(2, 5).toString(16);
} catch (err) {
console.log("readIntBE exception: " + JSON.stringify(err));
}
```
### readUInt8
......@@ -1673,11 +1443,6 @@ console.log(buf.readUInt8(1).toString());
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUInt8(0x42);
try {
let ref = buf1.readUInt8(4).toString(16);
} catch (err) {
console.log("readUInt8 exception: " + JSON.stringify(err));
}
```
### readUInt16BE
......@@ -1720,11 +1485,6 @@ console.log(buf.readUInt16BE(1).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUInt16BE(0x1234, 0);
try {
let ref = buf1.readUInt16BE(3).toString(16);
} catch (err) {
console.log("readUInt16BE exception: " + JSON.stringify(err));
}
```
### readUInt16LE
......@@ -1767,11 +1527,6 @@ console.log(buf.readUInt16LE(1).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUInt16LE(0x1234, 0);
try {
let ref = buf1.readUInt16LE(3).toString(16);
} catch (err) {
console.log("readUInt16LE exception: " + JSON.stringify(err));
}
```
### readUInt32BE
......@@ -1813,11 +1568,6 @@ console.log(buf.readUInt32BE(0).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUInt32BE(0x12345678, 0);
try {
let ref = buf1.readUInt32BE(1).toString(16);
} catch (err) {
console.log("readUInt32BE exception: " + JSON.stringify(err));
}
```
### readUInt32LE
......@@ -1859,11 +1609,6 @@ console.log(buf.readUInt32LE(0).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUInt32LE(0x12345678, 0);
try {
let ref = buf1.readUInt32LE(1).toString(16);
} catch (err) {
console.log("readUInt32LE exception: " + JSON.stringify(err));
}
```
### readUIntBE
......@@ -1906,11 +1651,6 @@ console.log(buf.readUIntBE(0, 6).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUIntBE(0x13141516, 0, 4);
try {
let ref = buf1.readUIntBE(2, 3).toString(16);
} catch (err) {
console.log("readUIntBE exception: " + JSON.stringify(err));
}
```
### readUIntLE
......@@ -1953,11 +1693,6 @@ console.log(buf.readUIntLE(0, 6).toString(16));
let buf1 = buffer.allocUninitializedFromPool(4);
buf1.writeUIntLE(0x13141516, 0, 4);
try {
let ref = buf1.readUIntLE(2, 3).toString(16);
} catch (err) {
console.log("readUIntLE exception: " + JSON.stringify(err));
}
```
### subarray
......@@ -2029,13 +1764,6 @@ console.log(buf1.toString('hex')); // 打印: 0102030405060708
buf1.swap16();
console.log(buf1.toString('hex')); // 打印: 0201040306050807
let buf2 = buffer.from("132");
try {
buf2.swap16();
} catch (err) {
console.log("swap16 exception: " + JSON.stringify(err));
}
```
### swap32
......@@ -2071,13 +1799,6 @@ console.log(buf1.toString('hex')); // 打印: 0102030405060708
buf1.swap32();
console.log(buf1.toString('hex')); // 打印: 0403020108070605
let buf2 = buffer.from("132");
try {
buf2.swap32();
} catch (err) {
console.log("swap32 exception: " + JSON.stringify(err));
}
```
### swap64
......@@ -2112,13 +1833,6 @@ let buf1 = buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
console.log(buf1.toString('hex')); // 打印: 0102030405060708
buf1.swap64();
console.log(buf1.toString('hex')); // 打印: 0807060504030201
let buf2 = buffer.from("1234567");
try {
buf2.swap64();
} catch (err) {
console.log("swap64 exception: " + JSON.stringify(err));
}
```
### toJSON
......@@ -2180,13 +1894,6 @@ for (let i = 0; i < 26; i++) {
}
console.log(buf1.toString('utf-8'));
// 打印: abcdefghijklmnopqrstuvwxyz
let buf2 = buffer.from("abc");
try {
let str = buf2.toString("utf9");
} catch (err) {
console.log("toString exception: " + JSON.stringify(err));
}
```
### values
......@@ -2258,27 +1965,6 @@ console.log(`${len} bytes: ${buf.toString('utf-8', 0, len)}`);
let buffer1 = buffer.alloc(10);
let length = buffer1.write('abcd', 8);
let buf1 = buffer.alloc(8);
try {
let offset1 = buf1.write("abcde", "utf9");
} catch (err) {
console.log("write exception: " + JSON.stringify(err));
}
let buf2 = buffer.alloc(8);
try {
let offset2 = buf2.write(10);
} catch (err) {
console.log("write exception: " + JSON.stringify(err));
}
let buf3 = buffer.alloc(8);
try {
let offset3 = buf3.write("abcde", -1);
} catch (err) {
console.log("write exception: " + JSON.stringify(err));
}
```
### writeBigInt64BE
......@@ -2318,13 +2004,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeBigInt64BE(0x0102030405060708n, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeBigInt64BE(0x0102030405060708n, 1);
} catch (err) {
console.log("writeBigInt64BE exception: " + JSON.stringify(err));
}
```
### writeBigInt64LE
......@@ -2364,13 +2043,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeBigInt64LE(0x0102030405060708n, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeBigInt64LE(0x0102030405060708n, 1);
} catch (err) {
console.log("writeBigInt64LE exception: " + JSON.stringify(err));
}
```
### writeBigUInt64BE
......@@ -2410,13 +2082,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeBigUInt64BE(0xdecafafecacefaden, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeBigUInt64BE(0xdecafafecacefaden, 1);
} catch (err) {
console.log("writeBigUInt64BE exception: " + JSON.stringify(err));
}
```
### writeBigUInt64LE
......@@ -2456,13 +2121,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeBigUInt64LE(0xdecafafecacefaden, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeBigUInt64LE(0xdecafafecacefaden, 1);
} catch (err) {
console.log("writeBigUInt64LE exception: " + JSON.stringify(err));
}
```
### writeDoubleBE
......@@ -2502,13 +2160,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeDoubleBE(123.456, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeDoubleBE(123.456, 1);
} catch (err) {
console.log("writeDoubleBE exception: " + JSON.stringify(err));
}
```
### writeDoubleLE
......@@ -2548,13 +2199,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeDoubleLE(123.456, 0);
let buf1 = buffer.allocUninitializedFromPool(8);
try {
let ref = buf1.writeDoubleLE(123.456, 1);
} catch (err) {
console.log("writeDoubleLE exception: " + JSON.stringify(err));
}
```
### writeFloatBE
......@@ -2594,13 +2238,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeFloatBE(0xcafebabe, 0);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeFloatBE(0xcabcbcbc, 5);
} catch (err) {
console.log("writeFloatBE exception: " + JSON.stringify(err));
}
```
......@@ -2641,13 +2278,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(8);
buf.writeFloatLE(0xcafebabe, 0);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeFloatLE(0xcabcbcbc, 5);
} catch (err) {
console.log("writeFloatLE exception: " + JSON.stringify(err));
}
```
### writeInt8
......@@ -2688,13 +2318,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(2);
buf.writeInt8(2, 0);
buf.writeInt8(-2, 1);
let buf1 = buffer.allocUninitializedFromPool(2);
try {
let ref = buf1.writeInt8(2, -1);
} catch (err) {
console.log("writeInt8 exception: " + JSON.stringify(err));
}
```
......@@ -2735,13 +2358,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(2);
buf.writeInt16BE(0x0102, 0);
let buf1 = buffer.alloc(2);
try {
let ref = buf1.writeInt16BE(0x7bca, -1);
} catch (err) {
console.log("writeInt16BE exception: " + JSON.stringify(err));
}
```
......@@ -2782,13 +2398,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(2);
buf.writeInt16LE(0x0304, 0);
let buf1 = buffer.alloc(2);
try {
let ref = buf1.writeInt16LE(0x7bca, -1);
} catch (err) {
console.log("writeInt16LE exception: " + JSON.stringify(err));
}
```
### writeInt32BE
......@@ -2828,13 +2437,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeInt32BE(0x01020304, 0);
let buf1 = buffer.alloc(4);
try {
let ref = buf1.writeInt32BE(0x12345678, -1);
} catch (err) {
console.log("writeInt32BE exception: " + JSON.stringify(err));
}
```
......@@ -2875,13 +2477,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeInt32LE(0x05060708, 0);
let buf1 = buffer.alloc(4);
try {
let ref = buf1.writeInt32LE(0x12345678, -1);
} catch (err) {
console.log("writeInt32LE exception: " + JSON.stringify(err));
}
```
### writeIntBE
......@@ -2922,13 +2517,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(6);
buf.writeIntBE(0x1234567890ab, 0, 6);
let buf1 = buffer.allocUninitializedFromPool(6);
try {
let ref = buf1.writeIntBE(0x1234567890ab, 1, 6);
} catch (err) {
console.log("writeIntBE exception: " + JSON.stringify(err));
}
```
......@@ -2970,13 +2558,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(6);
buf.writeIntLE(0x1234567890ab, 0, 6);
let buf1 = buffer.allocUninitializedFromPool(6);
try {
let ref = buf1.writeIntLE(0x1234567890ab, 1, 6);
} catch (err) {
console.log("writeIntLE exception: " + JSON.stringify(err));
}
```
### writeUInt8
......@@ -3019,13 +2600,6 @@ buf.writeUInt8(0x3, 0);
buf.writeUInt8(0x4, 1);
buf.writeUInt8(0x23, 2);
buf.writeUInt8(0x42, 3);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUInt8(0x42, -1);
} catch (err) {
console.log("writeUInt8 exception: " + JSON.stringify(err));
}
```
### writeUInt16BE
......@@ -3066,13 +2640,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeUInt16BE(0xdead, 0);
buf.writeUInt16BE(0xbeef, 2);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUInt16BE(0xdeadfc, 0);
} catch (err) {
console.log("writeUInt16BE exception: " + JSON.stringify(err));
}
```
### writeUInt16LE
......@@ -3113,13 +2680,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeUInt16LE(0xdead, 0);
buf.writeUInt16LE(0xbeef, 2);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUInt16LE(0xdeadfc, 0);
} catch (err) {
console.log("writeUInt16LE exception: " + JSON.stringify(err));
}
```
### writeUInt32BE
......@@ -3159,13 +2719,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeUInt32BE(0xfeedface, 0);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUInt32BE(0xfeedface, -1);
} catch (err) {
console.log("writeUInt32BE exception: " + JSON.stringify(err));
}
```
### writeUInt32LE
......@@ -3205,13 +2758,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(4);
buf.writeUInt32LE(0xfeedface, 0);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUInt32LE(0xfeedface, -1);
} catch (err) {
console.log("writeUInt32LE exception: " + JSON.stringify(err));
}
```
### writeUIntBE
......@@ -3252,13 +2798,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(6);
buf.writeUIntBE(0x1234567890ab, 0, 6);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUIntBE(0x13141516, 0, 1);
} catch (err) {
console.log("writeUIntBE exception: " + JSON.stringify(err));
}
```
### writeUIntLE
......@@ -3299,13 +2838,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.allocUninitializedFromPool(6);
buf.writeUIntLE(0x1234567890ab, 0, 6);
let buf1 = buffer.allocUninitializedFromPool(4);
try {
let ref = buf1.writeUIntLE(0x13141516, 0, 1);
} catch (err) {
console.log("writeUIntLE exception: " + JSON.stringify(err));
}
```
### transcode
......@@ -3338,25 +2870,6 @@ import buffer from '@ohos.buffer';
let buf = buffer.alloc(50);
let newBuf = buffer.transcode(buffer.from(''), 'utf-8', 'ascii');
console.log(newBuf.toString('ascii'));
try {
let buf1 = buffer.transcode(10, "utf8", "ucs2");
} catch (err) {
console.log("transcode exception: " + JSON.stringify(err));
}
let buf2 = buffer.from("测试");
try {
let buf3 = buffer.transcode(buf2, 0, "ucs2");
} catch (err) {
console.log("transcode exception: " + JSON.stringify(err));
}
try {
let buf3 = buffer.transcode(buf2, "utf8", 0);
} catch (err) {
console.log("transcode exception: " + JSON.stringify(err));
}
```
## Blob
......@@ -3387,24 +2900,12 @@ Blob的构造函数。
**示例:**
```ts
import buffer from '@ohos.buffer';
let blob = new buffer.Blob(['a', 'b', 'c']);
let blob1 = new buffer.Blob(['a', 'b', 'c'], {endings:'native', type: 'MIME'});
try {
let blob1 = new buffer.Blob(["a", "b", "c"], 10);
} catch (err) {
console.log("Blob constructor exception: " + JSON.stringify(err));
}
```ts
import buffer from '@ohos.buffer';
try {
let blob2 = new buffer.Blob("abc", { type: "new type", endings: "transparent" });
} catch (err) {
console.log("Blob constructor exception: " + JSON.stringify(err));
}
```
let blob = new buffer.Blob(['a', 'b', 'c']);
let blob1 = new buffer.Blob(['a', 'b', 'c'], {endings:'native', type: 'MIME'});
```
### encode
......@@ -3420,14 +2921,14 @@ arrayBuffer(): Promise&lt;ArrayBuffer&gt;
| Promise&lt;ArrayBuffer&gt; | 返回包含Blob数据的ArrayBuffer的Promise。 |
**示例:**
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let pro = blob.arrayBuffer();
pro.then(val => {
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let pro = blob.arrayBuffer();
pro.then(val => {
let uintarr = new Uint8Array(val);
console.log(uintarr.toString());
});
```
});
```
### slice
slice(start?: number, end?: number, type?: string): Blob
......@@ -3450,11 +2951,11 @@ slice(start?: number, end?: number, type?: string): Blob
| Blob | 新的Blob实例对象。 |
**示例:**
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let blob2 = blob.slice(0, 2);
let blob3 = blob.slice(0, 2, "MIME");
```
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let blob2 = blob.slice(0, 2);
let blob3 = blob.slice(0, 2, "MIME");
```
### text
......@@ -3470,10 +2971,10 @@ text(): Promise&lt;string&gt;
| Promise&lt;string&gt; | 包含以UTF8编码的文本的Promise。 |
**示例:**
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let pro = blob.text();
pro.then(val => {
```ts
let blob = new buffer.Blob(['a', 'b', 'c']);
let pro = blob.text();
pro.then(val => {
console.log(val)
});
```
\ No newline at end of file
});
```
\ No newline at end of file
......@@ -14,16 +14,16 @@
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
|----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | string | 是 | 否 | 应用程序的名称。 |
| description | string | 是 | 否 | 应用程序的描述。 |
| descriptionId | number | 是 | 否 | 应用程序的描述id。 |
| systemApp | boolean | 是 | 否 | 判断是否为系统应用程序,默认为false。 |
| enabled | boolean | 是 | 否 | 判断应用程序是否可以使用,默认为true。 |
| label | string | 是 | 否 | 应用程序显示的标签。 |
| labelId<sup>(deprecated)</sup> | string | 是 | 否 | 应用程序的标签id。<br />\- **说明:** 从API version 9开始废弃,使用labelIndex。 |
| labelId | string | 是 | 否 | 应用程序的标签id。 |
| icon | string | 是 | 否 | 应用程序的图标。 |
| iconId<sup>(deprecated)</sup> | string | 是 | 否 | 应用程序的图标id。<br />\- **说明:** 从API version 9开始废弃,使用iconIndex。 |
| iconId | string | 是 | 否 | 应用程序的图标id。 |
| process | string | 是 | 否 | 应用程序的进程,如果不设置,默认为包的名称。 |
| supportedModes | number | 是 | 否 | 标识应用支持的运行模式,当前只定义了驾驶模式(drive)。该标签只适用于车机。 |
| moduleSourceDirs | Array\<string> | 是 | 否 | 应用程序的资源存放的相对路径。 |
......
# ShortcutInfo<sup>(deprecated)<sup>
> 从API version 9开始不再维护,建议使用[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)替代
> **说明:**
>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -1555,7 +1555,7 @@ cleanBundleCacheFiles(bundleName: string): Promise\<void>;
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700030 | The specified bundle does not support cleaning cache files. |
| 17700030 | The specified bundle does not support clearing of cache files. |
**示例:**
......@@ -2033,7 +2033,7 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba
| 错误码ID | 错误信息 |
| -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. |
**示例:**
......@@ -2082,7 +2082,7 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void
| 错误码ID | 错误信息 |
| -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. |
**示例:**
......@@ -2299,7 +2299,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified extensionAbilityName is not existed. |
| 17700003 | The specified extensionAbilityName not existed. |
| 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. |
......@@ -2353,7 +2353,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified extensionAbilityName is not existed. |
| 17700003 | The specified extensionAbilityName not existed. |
| 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. |
......@@ -2734,7 +2734,7 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: num
| 错误码ID | 错误信息 |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. |
**示例:**
......
......@@ -37,11 +37,11 @@ on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
注册监听应用的安装,卸载,更新。
**需要权限:**ohos.permission.LISTEN_BUNDLE_CHANGE
**需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE
**系统API:** 此接口为系统接口,三方应用不支持调用
**系统能力:**SystemCapability.BundleManager.BundleFramework.Core
**系统能力:** SystemCapability.BundleManager.BundleFramework.Core
**参数:**
......@@ -50,10 +50,6 @@ on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
| BundleChangedEvent | string | 是 | 注册监听的事件类型。 |
| Callback\<BundleChangedInfo> | callback | 是 | 注册监听的回调函数。 |
**错误码:**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```ts
......@@ -74,11 +70,11 @@ off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
注销监听应用的安装,卸载,更新。
**需要权限:**ohos.permission.LISTEN_BUNDLE_CHANGE
**需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE
**系统API:** 此接口为系统接口,三方应用不支持调用
**系统能力:**SystemCapability.BundleManager.BundleFramework.Core
**系统能力:** SystemCapability.BundleManager.BundleFramework.Core
**参数:**
......@@ -87,10 +83,6 @@ off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
| BundleChangedEvent | string | 是 | 注销监听的事件类型。 |
| Callback\<BundleChangedInfo> | callback | 是 | 注销监听的回调函数,当为空时表示注销当前事件的所有callback。 |
**错误码:**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```ts
......
......@@ -48,7 +48,7 @@ buffer数组的列表。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ---------- | ---- | ---- | ---------- |
| data | Uint8Array | 是 | 是 | 数据列表。 |
| data | Array<Uint8Array> | 是 | 是 | 数据列表。 |
## EncodingFormat
......@@ -1581,9 +1581,9 @@ convertKey(pubKey : DataBlob, priKey : DataBlob, callback : AsyncCallback\<KeyPa
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ------------------------------ |
| pubKey | DataBlob | 否 | 指定的公钥材料。 |
| priKey | DataBlob | 否 | 指定的私钥材料。 |
| -------- | ----------- | ---- | ------------------------------ |
| pubKey | DataBlob | 是 | 指定的公钥材料。如果公钥不需要转换,可直接传入null |
| priKey | DataBlob | 是 | 指定的私钥材料。如果私钥不需要转换,可直接传入null |
| callback | AsyncCallback\<KeyPair> | 是 | 回调函数,用于获取非对称密钥。 |
**示例:**
......@@ -1614,8 +1614,8 @@ convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise\<KeyPair>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------- | ---- | ---------------- |
| pubKey | DataBlob | 否 | 指定的公钥材料。 |
| priKey | DataBlob | 否 | 指定的私钥材料。 |
| pubKey | DataBlob | 是 | 指定的公钥材料。如果公钥不需要转换,可直接传入null |
| priKey | DataBlob | 是 | 指定的私钥材料。如果私钥不需要转换,可直接传入null |
**返回值:**
......@@ -2586,7 +2586,7 @@ createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\<X509Cert>) : v
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | -------------------------- |
| inStream | [EncodingBlob](#encodingblob) | 是 | X509证书序列化数据 |
| callback | AsyncCallback\<X509Cert> | | 回调函数。表示X509证书对象 |
| callback | AsyncCallback\<X509Cert> | | 回调函数。表示X509证书对象 |
**示例**
......@@ -2666,7 +2666,7 @@ verify(key : PubKey, callback : AsyncCallback\<void>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| key | [PubKey](#pubkey) | 是 | 用于验签的公钥对象 |
| callback | AsyncCallback\<void>) | 否 | 回调函数。使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,不为null表示失败 |
| callback | AsyncCallback\<void> | 是 | 回调函数。使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,不为null表示失败 |
**示例**
......@@ -2757,7 +2757,7 @@ getEncoded(callback : AsyncCallback\<EncodingBlob>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | | 回调函数。表示X509证书序列化数据 |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | | 回调函数。表示X509证书序列化数据 |
**示例**
......@@ -2838,7 +2838,7 @@ getPublicKey(callback : AsyncCallback\<PubKey>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------- | ---- | -------------------------- |
| callback | AsyncCallback | 否 | 回调函数,X509证书公钥对象 |
| callback | AsyncCallback\<PubKey> | 是 | 回调函数,X509证书公钥对象 |
**示例**
......@@ -2920,7 +2920,7 @@ checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| date | string | 是 | 日期 |
| callback | AsyncCallback\<void> | | 回调函数。使用AsyncCallback的第一个error参数判断是否检查成功,error为null表示成功,不为null表示失败 |
| callback | AsyncCallback\<void> | | 回调函数。使用AsyncCallback的第一个error参数判断是否检查成功,error为null表示成功,不为null表示失败 |
**示例**
......@@ -3550,7 +3550,7 @@ createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\<X509Crl>) : voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ------------------------------ |
| inStream | [EncodingBlob](#encodingblob) | 是 | 表示证书吊销列表序列化数据 |
| callback | AsyncCallback\<X509Crl> | | 回调函数。表示证书吊销列表对象 |
| callback | AsyncCallback\<X509Crl> | | 回调函数。表示证书吊销列表对象 |
**示例**
......@@ -3630,7 +3630,7 @@ isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | ----------------------------------------------------------- |
| cert | [X509Cert](#x509cert) | 是 | 表示被检查的证书对象 |
| callback | AsyncCallback\<boolean> | | 回调函数。表示证书吊销状态,true表示已吊销,false表示未吊销 |
| callback | AsyncCallback\<boolean> | | 回调函数。表示证书吊销状态,true表示已吊销,false表示未吊销 |
**示例**
......@@ -3757,7 +3757,7 @@ getEncoded(callback : AsyncCallback\<EncodingBlob>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<EncodingBlob> | | 回调函数,表示X509证书吊销列表的序列化数据 |
| callback | AsyncCallback\<EncodingBlob> | | 回调函数,表示X509证书吊销列表的序列化数据 |
**示例**
......@@ -3839,7 +3839,7 @@ verify(key : PubKey, callback : AsyncCallback\<void>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| key | PubKey | 是 | 表示用于验签的公钥对象 |
| callback | AsyncCallback\<void> | | 回调函数,使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,error不为null表示失败。 |
| callback | AsyncCallback\<void> | | 回调函数,使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,error不为null表示失败。 |
**示例**
......@@ -4075,7 +4075,7 @@ getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) :
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ---------------------------- | ---- | -------------------------------- |
| serialNumber | number | 是 | 表示证书序列号 |
| callback | AsyncCallback\<X509CrlEntry> | | 回调函数。表示被吊销X509证书对象 |
| callback | AsyncCallback\<X509CrlEntry> | | 回调函数。表示被吊销X509证书对象 |
**示例**
......@@ -4167,7 +4167,7 @@ getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------- |
| cert | X509Cert | 是 | 表示证书对象 |
| callback | AsyncCallback\<X509CrlEntry> | | 回调函数,表示被吊销X509证书对象 |
| callback | AsyncCallback\<X509CrlEntry> | | 回调函数,表示被吊销X509证书对象 |
**示例**
......@@ -4258,7 +4258,7 @@ getRevokedCerts(callback : AsyncCallback<Array\<X509CrlEntry>>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback<Array\<X509CrlEntry>> | | 回调函数。表示被吊销X509证书列表 |
| callback | AsyncCallback<Array\<X509CrlEntry>> | | 回调函数。表示被吊销X509证书列表 |
**示例**
......@@ -4339,7 +4339,7 @@ getTbsInfo(callback : AsyncCallback\<DataBlob>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------------- |
| callback | AsyncCallback\<[DataBlob](#datablob)> | | 回调函数。表示证书吊销列表的tbsCertList信息 |
| callback | AsyncCallback\<[DataBlob](#datablob)> | | 回调函数。表示证书吊销列表的tbsCertList信息 |
**示例**
......@@ -4608,7 +4608,7 @@ validate(certChain : CertChainData, callback : AsyncCallback\<void>) : void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| certChain | [CertChainData](#certchaindata) | 是 | 表示X509证书链序列化数据 |
| callback | AsyncCallback\<void> | | 回调函数。使用AsyncCallback的第一个error参数判断是否校验成功,error为null表示成功,error不为null表示失败 |
| callback | AsyncCallback\<void> | | 回调函数。使用AsyncCallback的第一个error参数判断是否校验成功,error为null表示成功,error不为null表示失败 |
**示例**
......@@ -4706,7 +4706,7 @@ getEncoded(callback : AsyncCallback\<EncodingBlob>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | | 回调函数。表示被吊销证书的序列化数据 |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | | 回调函数。表示被吊销证书的序列化数据 |
**示例**
......@@ -4789,7 +4789,7 @@ getCertIssuer(callback : AsyncCallback\<DataBlob>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback\<[DataBlob](#datablob)> | | 回调函数。表示被吊销证书的颁发者信息 |
| callback | AsyncCallback\<[DataBlob](#datablob)> | | 回调函数。表示被吊销证书的颁发者信息 |
**示例**
......@@ -4848,7 +4848,7 @@ getRevocationDate(callback : AsyncCallback\<string>) : void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ------------------------------ |
| callback | AsyncCallback\<string> | | 回调函数。表示证书被吊销的日期 |
| callback | AsyncCallback\<string> | | 回调函数。表示证书被吊销的日期 |
**示例**
......
......@@ -263,7 +263,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callbac
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要删除的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />delete接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB的删除目前仅支持inKeys谓词。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />delete接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB的删除目前仅支持inKeys谓词。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数。当从数据库中删除一条或多条数据记录成功,err为undefined,data为获取到的已删除的数据记录数;否则为错误对象。<br />因部分数据库(如KVDB)的相应接口并不提供相应支持,故若服务端使用此数据库,则此callback也无法返回删除的数据记录数。 |
**示例:**
......@@ -301,7 +301,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promis
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要删除的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />delete接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB的删除目前仅支持inKeys谓词。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />delete接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB的删除目前仅支持inKeys谓词。 |
**返回值:**
......@@ -342,7 +342,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns:
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要查询的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />query接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB目前仅支持inKeys和prefixKey。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />query接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB目前仅支持inKeys和prefixKey。 |
| columns | Array&lt;string&gt; | 是 | 指示要查询的列。如果此参数为空,则查询所有列。 |
| callback | AsyncCallback&lt;[DataShareResultSet](js-apis-data-DataShareResultSet.md#datashareresultset)&gt; | 是 | 回调函数。当查询数据库中的数据成功,err为undefined,data为获取到的查询到的结果集;否则为错误对象。 |
......@@ -382,7 +382,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns:
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要查询的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />query接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB目前仅支持inKeys和prefixKey。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />query接口所支持的谓词方法取决于服务端所选用的数据库,如KVDB目前仅支持inKeys和prefixKey。 |
| columns | Array&lt;string&gt; | 是 | 指示要查询的列。如果此参数为空,则查询所有列。 |
**返回值:**
......@@ -425,7 +425,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value:
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要更新的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />update接口是否支持谓词筛选条件取决于服务端所选用的数据库,如KVDB目前并不支持谓词筛选条件,仅RDB支持。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />update接口是否支持谓词筛选条件取决于服务端所选用的数据库,如KVDB目前并不支持谓词筛选条件,仅RDB支持。 |
| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | 是 | 指示要更新的数据。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数。当更新数据库中的数据记录成功,err为undefined,data为获取到的更新的数据记录数;否则为错误对象。<br />因部分数据库(如KVDB)的相应接口并不提供相应支持,故若服务端使用此数据库,则此callback也无法返回更新的数据记录数。 |
......@@ -470,7 +470,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value:
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 指示要更新的数据的路径。 |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />update接口是否支持谓词筛选条件取决于服务端所选用的数据库,如KVDB目前并不支持谓词筛选条件,仅RDB支持。 |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件。<br />update接口是否支持谓词筛选条件取决于服务端所选用的数据库,如KVDB目前并不支持谓词筛选条件,仅RDB支持。 |
| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | 是 | 指示要更新的数据。 |
**返回值:**
......
......@@ -27,7 +27,7 @@ import defaultAppMgr from '@ohos.bundle.defaultAppManager';
**系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp
| 参数名 | 类型 | 值 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------------------------------------- | -------------------------------------- |
| BROWSER | string | Web Browser | 默认浏览器。 |
| IMAGE | string | Image Gallery | 默认图片查看器。 |
......@@ -58,10 +58,6 @@ isDefaultApplication(type: string): Promise\<boolean>
| ------------------------- | ------------------ |
| Promise\<boolean> | Promise形式返回当前应用是否是默认应用,true表示是默认应用,false表示不是默认应用。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
......@@ -90,10 +86,6 @@ isDefaultApplication(type: string, callback: AsyncCallback\<boolean>): void
| type | string | 是 | 要查询的应用类型,取[ApplicationType](#defaultappmgrapplicationtype)中的值。 |
| callback | AsyncCallback\<boolean> | 是 | 程序启动作为入参的回调函数,返回当前应用是否是默认应用,true表示是默认应用,false表示不是默认应用。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```ts
......@@ -266,15 +258,7 @@ defaultAppMgr.getDefaultApplication("image/png", (err, data) => {
## defaultAppMgr.setDefaultApplication
setDefaultApplication(type: string, elementName: ElementName, userId?: number): Promise\<BundleInfo>
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------------------- | --------------------------- |
| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回BundleInfo |
>
setDefaultApplication(type: string, elementName: ElementName, userId?: number): Promise\<void>
以异步方法根据系统已定义的应用类型或者符合媒体类型格式(type/subtype)的文件类型设置默认应用,使用Promise形式返回结果。
......@@ -296,7 +280,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
| 类型 | 说明 |
| -------------- | ---------------------------------- |
| Promise\<void> | Promise对象,无返回结果的Promise。 |
| Promise\<void> | Promise对象,无返回结果的Promise对象。 |
**错误码:**
......
......@@ -50,11 +50,6 @@ Deque的构造函数。
```ts
let deque = new Deque();
try {
let deque2 = Deque();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### insertFront
......@@ -90,11 +85,6 @@ deque.insertFront(b);
let c = {name : "Dylon", age : "13"};
deque.insertFront(c);
deque.insertFront(false);
try {
deque.insertFront.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### insertEnd
......@@ -130,11 +120,6 @@ deque.insertEnd(b);
let c = {name : "Dylon", age : "13"};
deque.insertEnd(c);
deque.insertEnd(false);
try {
deque.insertEnd.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### has
......@@ -172,11 +157,6 @@ let deque = new Deque();
let result = deque.has("squirrel");
deque.insertFront("squirrel");
let result1 = deque.has("squirrel");
try {
deque.has.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### popFirst
......@@ -211,11 +191,6 @@ deque.insertEnd(5);
deque.insertFront(2);
deque.insertFront(4);
let result = deque.popFirst();
try {
deque.popFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### popLast
......@@ -250,11 +225,6 @@ deque.insertFront(5);
deque.insertFront(2);
deque.insertFront(4);
let result = deque.popLast();
try {
deque.popLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -300,13 +270,6 @@ deque.insertEnd(4);
deque.forEach((value, index) => {
console.log("value:" + value, index);
});
try {
deque.forEach.bind({}, (value, index) => {
console.log("value:" + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getFirst
......@@ -340,11 +303,6 @@ deque.insertEnd(4);
deque.insertFront(5);
deque.insertFront(4);
let result = deque.getFirst();
try {
deque.getFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLast
......@@ -378,11 +336,6 @@ deque.insertFront(4);
deque.insertFront(5);
deque.insertFront(4);
let result = deque.getLast();
try {
deque.getLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -427,9 +380,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
deque[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -236,7 +236,7 @@ on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 监听事件。<br/>- type为"add",表示增加显示设备事件。例如:PC上插入显示器。<br/>- type为"remove",表示移除显示设备事件。例如:PC上移除显示器。<br/>- type为"change",表示改变显示设备事件。例如:显示器方向改变。 |
| type | string | 是 | 监听事件。<br/>- type为"add",表示增加显示设备事件。例如:插入显示器。<br/>- type为"remove",表示移除显示设备事件。例如:移除显示器。<br/>- type为"change",表示改变显示设备事件。例如:显示器方向改变。 |
| callback | Callback&lt;number&gt; | 是 | 回调函数。返回监听到的显示设备的id。 |
**示例:**
......
......@@ -363,10 +363,6 @@ getDispatchInfo(callback: AsyncCallback\<DispatchInfo>): void;
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<[DispatchInfo](js-apis-bundleManager-dispatchInfo.md)> | 是 | 回调函数。当函数调用成功,err为null,data为获取到的[DispatchInfo](js-apis-bundleManager-dispatchInfo.md)信息。否则为错误对象。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```js
......@@ -402,10 +398,6 @@ getDispatchInfo(): Promise\<DispatchInfo>;
| ------------------------------------------------ | ------------------------------------------------------------ |
| Promise<[DispatchInfo](js-apis-bundleManager-dispatchInfo.md)> | Promise对象,返回[DispatchInfo](js-apis-bundleManager-dispatchInfo.md)信息。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```js
......
......@@ -1063,7 +1063,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 是 | 指定位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
| latitude | number | 是 | 是 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude | number | 是 | 是 | 表示经度信息,正值表示东经,负值表示西经。 |
......@@ -1077,9 +1077,9 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 是 | 表示位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
| description | number | 是 | 是 | 表示位置信息描述,如“上海市浦东新区xx路xx号”。 |
| description | string | 是 | 是 | 表示位置信息描述,如“上海市浦东新区xx路xx号”。 |
| maxItems | number | 是 | 是 | 表示返回位置信息的最大个数。 |
| minLatitude | number | 是 | 是 | 表示最小纬度信息,与下面三个参数一起,表示一个经纬度范围。 |
| minLongitude | number | 是 | 是 | 表示最小经度信息。 |
......@@ -1094,7 +1094,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| latitude | number | 是 | 否 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude | number | 是 | 否 | 表示经度信息,正值表示东经,负值表是西经。 |
| locale | string | 是 | 否 | 表示位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
......@@ -1123,7 +1123,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示优先级信息。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示场景信息。 |
| timeInterval | number | 是 | 是 | 表示上报位置信息的时间间隔。 |
......@@ -1138,7 +1138,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示优先级信息。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示场景信息。 |
| maxAccuracy | number | 是 | 是| 表示精度信息,单位是米。仅在精确位置功能场景下有效,模糊位置功能生效场景下该字段无意义。 |
......@@ -1152,7 +1152,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Gnss
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| satellitesNumber | number | 是 | 否 | 表示卫星个数。 |
| satelliteIds | Array&lt;number&gt; | 是 | 否 | 表示每个卫星的ID,数组类型。 |
| carrierToNoiseDensitys | Array&lt;number&gt; | 是 | 否 | 表示载波噪声功率谱密度比,即cn0。 |
......@@ -1168,7 +1168,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): P
**系统能力**:SystemCapability.Location.Location.Gnss
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| reportingPeriodSec | number | 是 | 是 | 表示GNSS缓存位置上报的周期,单位是毫秒。 |
| wakeUpCacheQueueFull | boolean | 是 | 是 | true表示GNSS芯片底层缓存队列满之后会主动唤醒AP芯片,并把缓存位置上报给应用。<br/>false表示GNSS芯片底层缓存队列满之后不会主动唤醒AP芯片,会把缓存位置直接丢弃。 |
......@@ -1179,12 +1179,12 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Geofence
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| latitude | number | 是 | 表示纬度。 |
| longitude | number | 是 | 表示经度。 |
| radius | number | 是 | 表示圆形围栏的半径。 |
| expiration | number | 是 | 围栏存活的时间,单位是毫秒。 |
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| latitude | number | 是 | 是 |表示纬度。 |
| longitude | number | 是 |是 | 表示经度。 |
| radius | number | 是 |是 | 表示圆形围栏的半径。 |
| expiration | number | 是 |是 | 围栏存活的时间,单位是毫秒。 |
## GeofenceRequest
......@@ -1194,7 +1194,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Geofence
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示位置信息优先级。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示定位场景。 |
| geofence | [Geofence](#geofence) | 是 | 是 | 表示围栏信息。 |
......@@ -1220,7 +1220,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示定位场景。 |
| command | string | 是 | 是 | 扩展命令字符串。 |
......@@ -1232,7 +1232,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| latitude | number| 是 | 否 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude | number| 是 | 否 | 表示经度信息,正值表示东经,负值表是西经。 |
| altitude | number | 是 | 否 | 表示高度信息,单位米。 |
......@@ -1255,7 +1255,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| location | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 是 | 表示经纬度信息。 |
| geoAddress | [GeoAddress](#geoaddress) | 是 | 是 |表示地名信息。 |
......@@ -1269,7 +1269,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| timeInterval | number | 是 | 是 | 表示模拟位置上报的时间间隔,单位是秒。 |
| locations | Array&lt;Location&gt; | 是 | 是 | 表示模拟位置数组。 |
......@@ -1281,7 +1281,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| country | string | 是 | 否 | 表示国家码字符串。 |
| type | [CountryCodeType](#countrycodetype) | 是 | 否 | 表示国家码信息来源。 |
......
......@@ -179,7 +179,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca
| -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 |
| request | [CachedGnssLocationsRequest](#cachedgnsslocationsrequest) | 是 | GNSS缓存功能配置参数 |
| callback | Callback&lt;boolean&gt; | 是 | 接收GNSS缓存位置上报。 |
| callback | Callback&lt;Array&lt;[Location](#location)&gt;&gt; | 是 | 接收GNSS缓存位置上报。 |
**示例**
......@@ -209,7 +209,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Locati
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 |
| callback | Callback&lt;boolean&gt; | 否 | 需要取消订阅的回调函数。若无此参数,则取消当前类型的所有订阅。 |
| callback | Callback&lt;Array&lt;[Location](#location)&gt;&gt; | 否 | 需要取消订阅的回调函数。若无此参数,则取消当前类型的所有订阅。 |
**示例**
......@@ -447,7 +447,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | | 设置位置请求参数。 |
| request | [CurrentLocationRequest](#currentlocationrequest) | | 设置位置请求参数。 |
| callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收位置信息的回调。 |
**示例**
......@@ -464,6 +464,38 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L
}
};
geolocation.getCurrentLocation(requestInfo, locationChange);
```
## geolocation.getCurrentLocation
getCurrentLocation(callback: AsyncCallback&lt;Location&gt;): void
获取当前位置,使用callback回调异步返回结果。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Location.Location.Core
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收位置信息的回调。 |
**示例**
```ts
import geolocation from '@ohos.geolocation';
var locationChange = (err, location) => {
if (err) {
console.log('locationChanger: err=' + JSON.stringify(err));
}
if (location) {
console.log('locationChanger: location=' + JSON.stringify(location));
}
};
geolocation.getCurrentLocation(locationChange);
```
......@@ -1230,7 +1262,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 是 | 指定位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
| latitude | number | 是 | 是 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude | number | 是 | 是 | 表示经度信息,正值表示东经,负值表示西经。 |
......@@ -1246,9 +1278,9 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 是 | 表示位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
| description | number | 是 | 是 | 表示位置信息描述,如“上海市浦东新区xx路xx号”。 |
| description | string | 是 | 是 | 表示位置信息描述,如“上海市浦东新区xx路xx号”。 |
| maxItems | number | 是 | 是 | 表示返回位置信息的最大个数。 |
| minLatitude | number | 是 | 是 | 表示最小纬度信息,与下面三个参数一起,表示一个经纬度范围。 |
| minLongitude | number | 是 | 是 | 表示最小经度信息。 |
......@@ -1265,7 +1297,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Geocoder
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| latitude<sup>7+</sup> | number | 是 | 否 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude<sup>7+</sup> | number | 是 | 否 | 表示经度信息,正值表示东经,负值表是西经。 |
| locale<sup>7+</sup> | string | 是 | 否 | 表示位置描述信息的语言,“zh”代表中文,“en”代表英文。 |
......@@ -1295,7 +1327,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示优先级信息。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示场景信息。 |
| timeInterval | number | 是 | 是 | 表示上报位置信息的时间间隔。 |
......@@ -1312,7 +1344,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示优先级信息。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示场景信息。 |
| maxAccuracy | number | 是 | 是| 表示精度信息,单位是米。仅在精确位置功能场景下有效,模糊位置功能生效场景下该字段无意义。 |
......@@ -1328,7 +1360,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Gnss
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| satellitesNumber | number | 是 | 否 | 表示卫星个数。 |
| satelliteIds | Array&lt;number&gt; | 是 | 否 | 表示每个卫星的ID,数组类型。 |
| carrierToNoiseDensitys | Array&lt;number&gt; | 是 | 否 | 表示载波噪声功率谱密度比,即cn0。 |
......@@ -1346,7 +1378,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
**系统能力**:SystemCapability.Location.Location.Gnss
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| reportingPeriodSec | number | 是 | 是 | 表示GNSS缓存位置上报的周期,单位是毫秒。 |
| wakeUpCacheQueueFull | boolean | 是 | 是 | true表示GNSS芯片底层缓存队列满之后会主动唤醒AP芯片,并把缓存位置上报给应用。<br/>false表示GNSS芯片底层缓存队列满之后不会主动唤醒AP芯片,会把缓存位置直接丢弃。 |
......@@ -1360,7 +1392,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Geofence
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| latitude | number | 是 | 是 | 表示纬度。 |
| longitude | number | 是 | 是 | 表示经度。 |
| radius | number | 是 | 是 | 表示圆形围栏的半径。 |
......@@ -1376,7 +1408,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Geofence
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| priority | [LocationRequestPriority](#locationrequestpriority) | 是 | 是 | 表示位置信息优先级。 |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示定位场景。 |
| geofence | [Geofence](#geofence)| 是 | 是 | 表示围栏信息。 |
......@@ -1406,7 +1438,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| scenario | [LocationRequestScenario](#locationrequestscenario) | 是 | 是 | 表示定位场景。 |
| command | string | 是 | 是 | 扩展命令字符串。 |
......@@ -1420,7 +1452,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。
**系统能力**:SystemCapability.Location.Location.Core
| 名称 | 类型 | 可读|可写 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| latitude<sup>7+</sup> | number | 是 | 否 | 表示纬度信息,正值表示北纬,负值表示南纬。 |
| longitude<sup>7+</sup> | number | 是 | 否 | 表示经度信息,正值表示东经,负值表是西经。 |
| altitude<sup>7+</sup> | number | 是 | 否 | 表示高度信息,单位米。 |
......
......@@ -52,11 +52,6 @@ HashMap的构造函数。
```ts
let hashMap = new HashMap();
try {
let hashMap2 = HashMap();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -87,11 +82,6 @@ isEmpty(): boolean
```ts
const hashMap = new HashMap();
let result = hashMap.isEmpty();
try {
hashMap.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -130,11 +120,6 @@ let hashMap = new HashMap();
let result = hashMap.hasKey("squirrel");
hashMap.set("squirrel", 123);
let result1 = hashMap.hasKey("squirrel");
try {
hashMap.hasKey.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -173,11 +158,6 @@ let hashMap = new HashMap();
let result = hashMap.hasValue(123);
hashMap.set("squirrel", 123);
let result1 = hashMap.hasValue(123);
try {
hashMap.hasValue.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -216,11 +196,6 @@ let hashMap = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let result = hashMap.get("sparrow");
try {
hashMap.get.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -254,11 +229,6 @@ hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let newHashMap = new HashMap();
hashMap.setAll(newHashMap);
try {
hashMap.setAll.bind({}, newHashMap)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -296,11 +266,6 @@ set(key: K, value: V): Object
```ts
let hashMap = new HashMap();
let result = hashMap.set("squirrel", 123);
try {
hashMap.set.bind({}, "squirrel", 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -339,11 +304,6 @@ let hashMap = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
let result = hashMap.remove("sparrow");
try {
hashMap.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -370,11 +330,6 @@ let hashMap = new HashMap();
hashMap.set("squirrel", 123);
hashMap.set("sparrow", 356);
hashMap.clear();
try {
hashMap.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -412,11 +367,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
hashMap.keys.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -454,11 +404,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
hashMap.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -497,11 +442,6 @@ replace(key: K, newValue: V): boolean
let hashMap = new HashMap();
hashMap.set("sparrow", 123);
let result = hashMap.replace("sparrow", 357);
try {
hashMap.replace.bind({}, "sparrow", 357)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -544,13 +484,6 @@ hashMap.set("gull", 357);
hashMap.forEach((value, key) => {
console.log("value:" + value, key);
});
try {
hashMap.forEach.bind({}, (value, key) => {
console.log("value:" + value, key);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -589,11 +522,6 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
hashMap.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -639,9 +567,4 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
hashMap[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -60,11 +60,6 @@ HashSet的构造函数。
```ts
let hashSet = new HashSet();
try {
let hashSet2 = HashSet();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -95,11 +90,6 @@ isEmpty(): boolean
```ts
const hashSet = new HashSet();
let result = hashSet.isEmpty();
try {
hashSet.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -138,11 +128,6 @@ let hashSet = new HashSet();
let result = hashSet.has("squirrel");
hashSet.add("squirrel");
let result1 = hashSet.has("squirrel");
try {
hashSet.has.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -179,11 +164,6 @@ add(value: T): boolean
```ts
let hashSet = new HashSet();
let result = hashSet.add("squirrel");
try {
hashSet.add.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -222,11 +202,6 @@ let hashSet = new HashSet();
hashSet.add("squirrel");
hashSet.add("sparrow");
let result = hashSet.remove("sparrow");
try {
hashSet.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -253,11 +228,6 @@ let hashSet = new HashSet();
hashSet.add("squirrel");
hashSet.add("sparrow");
hashSet.clear();
try {
hashSet.remove.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -295,11 +265,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
hashSet.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -342,13 +307,6 @@ hashSet.add("squirrel");
hashSet.forEach((value, key) => {
console.log("value:" + value, key);
});
try {
hashSet.forEach.bind({}, (value, key) => {
console.log("value:" + value, key);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -386,11 +344,6 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
hashSet.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -435,9 +388,4 @@ while(temp != undefined) {
console.log("value: " + temp);
temp = iter.next().value;
}
try {
hashSet[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -1771,7 +1771,7 @@ createImageReceiver(width: number, height: number, format: number, capacity: num
| -------- | ------ | ---- | ---------------------- |
| width | number | 是 | 图像的默认宽度。 |
| height | number | 是 | 图像的默认高度。 |
| format | number | 是 | 图像格式,取值为[ImageFormat](#imageformat9)常量(目前该参数为使用者和camera约定的值,以后可能还有其他应用场景,receiver的作用只是传递,目前仅支持 ImageFormat:JPEG 格式)。 |
| format | number | 是 | 图像格式,取值为[ImageFormat](#imageformat9)常量(目前仅支持 ImageFormat:JPEG 和 4)。 |
| capacity | number | 是 | 同时访问的最大图像数。 |
**返回值:**
......
......@@ -108,7 +108,7 @@ try {
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------- | ------ | ---- | ---- | ------- |
| preKeys | Array<number> | 是 | 否 | 前置按键集合,数量范围[0, 4],前置按键无顺序要求。 |
| preKeys | Array\<number> | 是 | 否 | 前置按键集合,数量范围[0, 4],前置按键无顺序要求。 |
| finalKey | number | 是 | 否 | 最终按键,此项必填,最终按键触发上报回调函数。 |
| isFinalKeyDown | boolean | 是 | 否 | 最终按键状态。 |
| finalKeyDownDuration | number | 是 | 否 | 最终按键保持按下持续时间,为0时立即触发回调函数,大于0时,当isFinalKeyDown为true,则最终按键按下超过此时长后触发回调函数,当isFinalKeyDown为false,则最终按键按下到抬起时间小于此时长时触发回调函数。 |
......@@ -100,7 +100,7 @@ getInputMethodEngine(): InputMethodEngine
> **说明:**
>
>从API version 8开始支持,API version 9开始废弃, 建议使用[getInputMethodAbility()](#inputmethodenginegetinputmethodability9)替代。
> 从API version 8开始支持,API version 9开始废弃, 建议使用[getInputMethodAbility()](#inputmethodenginegetinputmethodability9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
......@@ -157,7 +157,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#keyboardcontroller), [TextInputClient](#textinputclient) | 是 | 回调函数,返回订阅输入法的KeyboardController和TextInputClient实例。 |
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | 是 | 回调函数,返回订阅输入法的KeyboardController和TextInputClient实例。 |
**示例:**
......@@ -181,7 +181,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#keyboardcontroller), [TextInputClient](#textinputclient) | 否 | 回调函数,返回取消订阅的KeyboardController和TextInputClient实例。 |
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | 否 | 回调函数,返回取消订阅的KeyboardController和TextInputClient实例。 |
**示例:**
......@@ -204,7 +204,7 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardShow',表示订阅输入法显示。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 是 | 回调函数。 |
| callback | () => void | 是 | 回调函数。 |
**示例:**
......@@ -230,7 +230,7 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardShow',表示订阅输入法显示。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 否 | 回调函数。 |
| callback | () => void | 否 | 回调函数。 |
**示例:**
......@@ -260,7 +260,7 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#keyboardcontroller), [InputClient](#inputclient9) | 是 | 回调函数,返回输入法操作相关实例。 |
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [InputClient](#inputclient9)) => void | 是 | 回调函数,返回输入法操作相关实例。 |
**示例:**
......@@ -284,7 +284,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClien
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStart’时表示订阅输入法绑定。 |
| callback | [KeyboardController](#keyboardcontroller), [InputClient](#inputclient9) | 否 | 回调函数,返回输入法操作相关实例。 |
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [InputClient](#inputclient9)) => void | 否 | 回调函数,返回输入法操作相关实例。 |
**示例:**
......@@ -307,7 +307,7 @@ on(type: 'inputStop', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStop’时表示订阅停止输入法应用事件。 |
| callback | void | 是 | 回调函数。 |
| callback | () => void | 是 | 回调函数。 |
**示例:**
......@@ -330,7 +330,7 @@ off(type: 'inputStop', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘inputStop’时表示订阅停止输入法应用事件。 |
| callback | void | 是 | 回调函数。 |
| callback | () => void | 是 | 回调函数。 |
**示例:**
......@@ -353,7 +353,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 回调函数,返回调用方window id。 |
| callback | (wid:number) => void | 是 | 回调函数,返回调用方window id。 |
**示例:**
......@@ -376,7 +376,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-type为‘setCallingWindow’时表示订阅设置调用窗口事件。 |
| callback | number | 是 | 回调函数,返回调用方window id。 |
| callback | (wid:number) => void | 是 | 回调函数,返回调用方window id。 |
**示例:**
......@@ -399,7 +399,7 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardShow',表示订阅输入法显示。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 否 | 回调函数。 |
| callback | () => void | 否 | 回调函数。 |
**示例:**
......@@ -425,7 +425,7 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardShow',表示订阅输入法显示。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | void | 否 | 回调函数。 |
| callback | () => void | 否 | 回调函数。 |
**示例:**
......@@ -451,7 +451,7 @@ on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'setSubtype',表示订阅输入法子类型设置。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | InputMethodSubtype | 是 | 回调函数,返回调用方的输入法子类型。 |
| callback | (inputMethodSubtype: [InputMethodSubtype](js-apis-inputmethod-subtype.md)) => void | 是 | 回调函数,返回调用方的输入法子类型。 |
**示例:**
......@@ -474,7 +474,7 @@ off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => v
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'setSubtype',表示取消订阅输入法子类型设置。<br/>-&nbsp;type为'keyboardHide',表示订阅输入法隐藏。 |
| callback | InputMethodSubtype | 否 | 回调函数,返回调用方的输入法子类型。 |
| callback | (inputMethodSubtype: [InputMethodSubtype](js-apis-inputmethod-subtype.md)) => void | 否 | 回调函数,返回调用方的输入法子类型。 |
**示例:**
......@@ -501,7 +501,7 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 |
| callback | [KeyEvent](#keyevent) | 是 | 回调函数,返回按键信息。 |
| callback | (event: [KeyEvent](#keyevent)) => boolean | 是 | 回调函数,返回按键信息。 |
**示例:**
......@@ -531,7 +531,7 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyDown',表示订阅硬键盘按下。<br/>-&nbsp;type为'keyUp',表示订阅硬键盘抬起。 |
| callback | [KeyEvent](#keyevent) | 否 | 回调函数,返回按键信息。 |
| callback | (event: [KeyEvent](#keyevent)) => boolean | 否 | 回调函数,返回按键信息。 |
**示例:**
......@@ -559,11 +559,11 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 光标变化事件。<br/>-type为’cursorContextChange‘时,表示光标变化。 |
| callback | number | 是 | 回调函数,返回光标信息。 |
| callback | (x: number, y:number, height:number) => void | 是 | 回调函数,返回光标信息。 |
**示例:**
**示例:**
```js
inputMethodEngine.getKeyboardDelegate().on('cursorContextChange', (x, y, height) => {
......@@ -586,7 +586,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 光标变化事件。<br/>-type为’cursorContextChange‘时,表示光标变化。 |
| callback | number | 否 | 回调函数,返回光标信息。 |
| callback | (x: number, y:number, height:number) => void | 否 | 回调函数,返回光标信息。 |
**示例:**
......@@ -609,7 +609,7 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本选择变化事件。<br/>-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 是 | 回调函数,返回文本选择信息。 |
| callback | (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void | 是 | 回调函数,返回文本选择信息。 |
**示例:**
......@@ -635,7 +635,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本选择变化事件。<br/>-type为’selectionChange‘时,表示选择文本变化。 |
| callback | number | 否 | 回调函数,返回文本选择信息。 |
| callback | (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void | 否 | 回调函数,返回文本选择信息。 |
**示例:**
......@@ -659,7 +659,7 @@ on(type: 'textChange', callback: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。<br/>-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 是 | 回调函数,返回当前文本内容。 |
| callback | (text: string) => void | 是 | 回调函数,返回当前文本内容。 |
**示例:**
......@@ -682,7 +682,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。<br/>-type为’textChange‘时,表示当前文本变化。 |
| callback | string | 否 | 回调函数,返回当前文本内容。 |
| callback | (text: string) => void | 否 | 回调函数,返回当前文本内容。 |
**示例:**
......
......@@ -35,10 +35,6 @@ getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | 是 | 回调函数,获取BundleInstaller对象,err为undefined,data为获取到的BundleInstaller对象;否则为错误对象。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```ts
......@@ -72,10 +68,6 @@ getBundleInstaller(): Promise\<BundleInstaller>;
| ------------------------------------------------------------ | ------------------------------------ |
| Promise\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | Promise对象,返回BundleInstaller对象。 |
**错误码:**
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:**
```ts
......@@ -277,10 +269,10 @@ try {
**系统接口:** 此接口为系统接口,三方应用不支持调用
| 参数名 | 类型 | 说明 |
| ---------- | ------ | ---------------- |
| moduleName | string | 应用程序模块名称。 |
| hashValue | string | 哈希值。 |
| 名称 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---------------- | ---------------- |
| moduleName | string | 是 | 应用程序模块名称。 |
| hashValue | string | 是 | 哈希值。 |
## InstallParam
......@@ -290,10 +282,10 @@ try {
**系统接口:** 此接口为系统接口,三方应用不支持调用
| 参数名 | 类型 | 说明 |
| ------------------------------ | ------------------------------ | ------------------ |
| userId | number | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户。 |
| installFlag | number | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 |
| isKeepData | boolean | 卸载时是否保留数据目录。 |
| hashParams | Array<[HashParam](#hashparam)> | 哈希值参数。 |
| crowdtestDeadline| number |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 |
\ No newline at end of file
| 名称 | 类型 | 必填 | 说明 |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | 是 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户。 |
| installFlag | number | 是 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 |
| isKeepData | boolean | 是 | 卸载时是否保留数据目录。 |
| hashParams | Array<[HashParam](#hashparam)> | 是 | 哈希值参数。 |
| crowdtestDeadline| number | 是 |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 |
\ No newline at end of file
......@@ -21,8 +21,6 @@ LightWeightMap和[HashMap](js-apis-hashmap.md)都是用来存储键值对的集
import LightWeightMap from '@ohos.util.LightWeightMap';
```
## LightWeightMap
### 属性
......@@ -55,11 +53,6 @@ LightWeightMap的构造函数。
```ts
let lightWeightMap = new LightWeightMap();
try {
let lightWeightMap2 = LightWeightMap();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -90,11 +83,6 @@ isEmpty(): boolean
```ts
const lightWeightMap = new LightWeightMap();
let result = lightWeightMap.isEmpty();
try {
lightWeightMap.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -135,11 +123,6 @@ lightWeightMap.set("sparrow", 356);
let map = new LightWeightMap();
map.set("sparrow", 356);
let result = lightWeightMap.hasAll(map);
try {
lightWeightMap.hasAll.bind({}, map)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -179,11 +162,6 @@ let result = lightWeightMap.hasKey;
lightWeightMap.hasKey("squirrel");
lightWeightMap.set("squirrel", 123);
let result1 = lightWeightMap.hasKey("squirrel");
try {
lightWeightMap.hasKey.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -222,11 +200,6 @@ let lightWeightMap = new LightWeightMap();
let result = lightWeightMap.hasValue(123);
lightWeightMap.set("squirrel", 123);
let result1 = lightWeightMap.hasValue(123);
try {
lightWeightMap.hasValue.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -257,11 +230,6 @@ increaseCapacityTo(minimumCapacity: number): void
```ts
let lightWeightMap = new LightWeightMap();
lightWeightMap.increaseCapacityTo(10);
try {
lightWeightMap.increaseCapacityTo.bind({}, 10)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -300,11 +268,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.get("sparrow");
try {
lightWeightMap.get.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -343,11 +306,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getIndexOfKey("sparrow");
try {
lightWeightMap.getIndexOfKey.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -386,11 +344,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getIndexOfValue(123);
try {
lightWeightMap.getIndexOfValue.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -430,16 +383,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getKeyAt(1);
try {
lightWeightMap.getKeyAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
lightWeightMap.getKeyAt(6)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -473,11 +416,6 @@ lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let map = new LightWeightMap();
lightWeightMap.setAll(map);
try {
lightWeightMap.setAll.bind({}, map)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -514,11 +452,6 @@ set(key: K, value: V): Object
```ts
let lightWeightMap = new LightWeightMap();
let result = lightWeightMap.set("squirrel", 123);
try {
lightWeightMap.set.bind({}, "squirrel", 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -557,11 +490,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
lightWeightMap.remove("sparrow");
try {
lightWeightMap.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -600,11 +528,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.removeAt(1);
try {
lightWeightMap.removeAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -645,16 +568,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
lightWeightMap.setValueAt(1, 3546);
try {
lightWeightMap.setValueAt.bind({}, 1, 3546)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
lightWeightMap.setValueAt(6, 3546);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -694,16 +607,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getValueAt(1);
try {
lightWeightMap.getValueAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
lightWeightMap.getValueAt(6);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -730,11 +633,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
lightWeightMap.clear();
try {
lightWeightMap.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -772,11 +670,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
lightWeightMap.keys.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -814,11 +707,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
lightWeightMap.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -861,13 +749,6 @@ lightWeightMap.set("gull", 357);
lightWeightMap.forEach((value, key) => {
console.log("value:" + value, key);
});
try {
lightWeightMap.forEach.bind({}, (value, key) => {
console.log("value:" + value, key);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -906,11 +787,6 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
lightWeightMap.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### toString
......@@ -942,11 +818,6 @@ let lightWeightMap = new LightWeightMap();
lightWeightMap.set("squirrel", 123);
lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.toString();
try {
lightWeightMap.toString.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -992,9 +863,4 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
lightWeightMap[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -22,8 +22,6 @@ LightWeightSet和[HashSet](js-apis-hashset.md)都是用来存储键值的集合
import LightWeightSet from '@ohos.util.LightWeightSet';
```
## LightWeightSet
### 属性
......@@ -55,11 +53,6 @@ LightWeightSet的构造函数。
```ts
let lightWeightSet = new LightWeightSet();
try {
let lightWeightSet2 = LightWeightSet();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -90,11 +83,6 @@ isEmpty(): boolean
```ts
const lightWeightSet = new LightWeightSet();
let result = lightWeightSet.isEmpty();
try {
lightWeightSet.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### add
......@@ -130,11 +118,6 @@ add(obj: T): boolean
```ts
let lightWeightSet = new LightWeightSet();
let result = lightWeightSet.add("squirrel");
try {
lightWeightSet.add.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -169,11 +152,6 @@ lightWeightSet.add("sparrow");
let set = new LightWeightSet();
set.add("gull");
let result = lightWeightSet.addAll(set);
try {
lightWeightSet.addAll.bind({}, set)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -214,11 +192,6 @@ lightWeightSet.add("sparrow");
let set = new LightWeightSet();
set.add("sparrow");
let result = lightWeightSet.hasAll(set);
try {
lightWeightSet.hasAll.bind({}, set)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -257,11 +230,6 @@ let lightWeightSet = new LightWeightSet();
let result = lightWeightSet.has(123);
lightWeightSet.add(123);
result = lightWeightSet.has(123);
try {
lightWeightSet.has.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -301,11 +269,6 @@ lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let obj = ["squirrel", "sparrow"];
let result = lightWeightSet.equal(obj);
try {
lightWeightSet.equal.bind({}, obj)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -337,16 +300,6 @@ increaseCapacityTo(minimumCapacity: number): void
```ts
let lightWeightSet = new LightWeightSet();
lightWeightSet.increaseCapacityTo(10);
try {
lightWeightSet.increaseCapacityTo.bind({}, 10)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
lightWeightSet.increaseCapacityTo(2);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -385,11 +338,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.getIndexOf("sparrow");
try {
lightWeightSet.getIndexOf.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -428,11 +376,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.remove("sparrow");
try {
lightWeightSet.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -471,11 +414,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.removeAt(1);
try {
lightWeightSet.removeAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -514,11 +452,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.getValueAt(1);
try {
lightWeightSet.getValueAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -545,11 +478,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
lightWeightSet.clear();
try {
lightWeightSet.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -582,11 +510,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.toString();
try {
lightWeightSet.toString.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -619,11 +542,6 @@ let lightWeightSet = new LightWeightSet();
lightWeightSet.add("squirrel");
lightWeightSet.add("sparrow");
let result = lightWeightSet.toArray();
try {
lightWeightSet.toArray.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -661,11 +579,6 @@ while(index < lightWeightSet.length) {
console.log(JSON.stringify(iter.next().value));
index++;
}
try {
lightWeightSet.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -708,13 +621,6 @@ lightWeightSet.add("gull");
lightWeightSet.forEach((value, key) => {
console.log("value:" + value, key);
});
try {
lightWeightSet.forEach.bind({}, (value, key) => {
console.log("value:" + value, key);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -752,11 +658,6 @@ while(index < lightWeightSet.length) {
console.log(JSON.stringify(iter.next().value));
index++;
}
try {
lightWeightSet.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -801,9 +702,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
lightWeightSet[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -20,9 +20,6 @@ LinkedList和[ArrayList](js-apis-arraylist.md)相比,存取数据的效率不
import LinkedList from '@ohos.util.LinkedList';
```
## LinkedList
### 属性
......@@ -55,11 +52,6 @@ LinkedList的构造函数。
```ts
let linkedList = new LinkedList();
try {
let linkedList2 = LinkedList();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -102,11 +94,6 @@ let result2 = linkedList.add(b);
let c = {name : "Dylon", age : "13"};
let result3 = linkedList.add(c);
let result4 = linkedList.add(false);
try {
linkedList.add.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### addFirst
......@@ -142,11 +129,6 @@ linkedList.addFirst(b);
let c = {name : "Dylon", age : "13"};
linkedList.addFirst(c);
linkedList.addFirst(false);
try {
linkedList.addFirst.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### insert
......@@ -180,16 +162,6 @@ let linkedList = new LinkedList();
linkedList.insert(0, "A");
linkedList.insert(1, 0);
linkedList.insert(2, true);
try {
linkedList.insert.bind({}, 3, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
linkedList.insert(6, "b");
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### has
......@@ -227,11 +199,6 @@ let linkedList = new LinkedList();
let result1 = linkedList.has("squirrel");
linkedList.add("squirrel");
let result = linkedList.has("squirrel");
try {
linkedList.has.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### get
......@@ -274,11 +241,6 @@ linkedList.add(1);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.get(2);
try {
linkedList.get.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLastIndexOf
......@@ -321,11 +283,6 @@ linkedList.add(1);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.getLastIndexOf(2);
try {
linkedList.getLastIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getIndexOf
......@@ -368,11 +325,6 @@ linkedList.add(1);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.getIndexOf(2);
try {
linkedList.getIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeByIndex
......@@ -414,16 +366,6 @@ linkedList.add(5);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.removeByIndex(2);
try {
linkedList.removeByIndex.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
linkedList.removeByIndex(8);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeFirst
......@@ -453,22 +395,12 @@ removeFirst(): T
```ts
let linkedList = new LinkedList();
try {
linkedList.removeFirst();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
linkedList.add(2);
linkedList.add(4);
linkedList.add(5);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.removeFirst();
try {
linkedList.removeFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeLast
......@@ -498,22 +430,12 @@ removeLast(): T
```ts
let linkedList = new LinkedList();
try {
linkedList.removeLast();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
linkedList.add(2);
linkedList.add(4);
linkedList.add(5);
linkedList.add(2);
linkedList.add(4);
let result = linkedList.removeLast();
try {
linkedList.removeLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### remove
......@@ -553,11 +475,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.remove(2);
try {
linkedList.remove.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeFirstFound
......@@ -593,21 +510,11 @@ removeFirstFound(element: T): boolean
```ts
let linkedList = new LinkedList();
try {
linkedList.removeFirstFound(4);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
linkedList.add(2);
linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.removeFirstFound(4);
try {
linkedList.removeFirstFound.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeLastFound
......@@ -643,21 +550,11 @@ removeLastFound(element: T): boolean
```ts
let linkedList = new LinkedList();
try {
linkedList.removeLastFound();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
linkedList.add(2);
linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.removeLastFound(4);
try {
linkedList.removeLastFound.bind({}, 4)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clone
......@@ -691,11 +588,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.clone();
try {
linkedList.clone.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -741,13 +633,6 @@ linkedList.add(4);
linkedList.forEach((value, index) => {
console.log("value:" + value, index);
});
try {
linkedList.forEach.bind({}, (value, index) => {
console.log("value:" + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clear
......@@ -775,11 +660,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
linkedList.clear();
try {
linkedList.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### set
......@@ -821,16 +701,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.set(2, "b");
try {
linkedList.set.bind({}, 2, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
linkedList.set(8, "b");
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### convertToArray
......@@ -863,11 +733,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.convertToArray();
try {
linkedList.convertToArray.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getFirst
......@@ -901,11 +766,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
let result = linkedList.getFirst();
try {
linkedList.getFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLast
......@@ -939,11 +799,6 @@ linkedList.add(4);
linkedList.add(5);
linkedList.add(4);
linkedList.getLast();
try {
linkedList.getLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -989,9 +844,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
linkedList[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -50,11 +50,6 @@ List的构造函数。
```ts
let list = new List();
try {
let list2 = List();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -97,11 +92,6 @@ let result3 = list.add(b);
let c = {name : "Dylon", age : "13"};
let result4 = list.add(c);
let result5 = list.add(false);
try {
list.add.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### insert
......@@ -135,16 +125,6 @@ let list = new List();
list.insert("A", 0);
list.insert(0, 1);
list.insert(true, 2);
try {
list.insert.bind({}, "b", 3)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
list.insert("b", 6);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### has
......@@ -182,11 +162,6 @@ let list = new List();
let result = list.has("squirrel");
list.add("squirrel");
let result1 = list.has("squirrel");
try {
list.has.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### get
......@@ -229,11 +204,6 @@ list.add(1);
list.add(2);
list.add(4);
let result = list.get(2);
try {
list.get.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLastIndexOf
......@@ -276,11 +246,6 @@ list.add(1);
list.add(2);
list.add(4);
let result = list.getLastIndexOf(2);
try {
list.getLastIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getIndexOf
......@@ -324,11 +289,6 @@ list.add(2);
list.add(4);
list.getIndexOf(2);
let result = list.getIndexOf(2);
try {
list.getIndexOf.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### equal
......@@ -374,11 +334,6 @@ obj1.add(5);
list.equal(obj1);
let obj2 = {name : "Dylon", age : "13"};
let result = list.equal(obj2);
try {
list.equal.bind({}, obj2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### removeByIndex
......@@ -420,16 +375,6 @@ list.add(5);
list.add(2);
list.add(4);
let result = list.removeByIndex(2);
try {
list.removeByIndex.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
list.removeByIndex(8);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### remove
......@@ -469,11 +414,6 @@ list.add(4);
list.add(5);
list.add(4);
let result = list.remove(2);
try {
list.remove.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### replaceAllElements
......@@ -522,13 +462,6 @@ list.replaceAllElements((value: number, index: number) => {
list.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
try {
list.replaceAllElements.bind({}, (value: number, index: number) => {
return value = 2 * value;
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -574,14 +507,6 @@ list.add(4);
list.forEach((value, index) => {
console.log("value: " + value, index);
});
try {
list.forEach.bind({}, (value, index) => {
console.log("value: " + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### sort
......@@ -623,11 +548,6 @@ list.add(5);
list.add(4);
list.sort((a: number, b: number) => a - b);
list.sort((a: number, b: number) => b - a);
try {
list.sort.bind({}, (a: number, b: number) => b - a)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getSubList
......@@ -671,16 +591,6 @@ list.add(4);
let result = list.getSubList(2, 4);
let result1 = list.getSubList(4, 3);
let result2 = list.getSubList(2, 6);
try {
list.getSubList.bind({}, 2, 4)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
list.getSubList(2, 10);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clear
......@@ -708,11 +618,6 @@ list.add(4);
list.add(5);
list.add(4);
list.clear();
try {
list.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### set
......@@ -754,16 +659,6 @@ list.add(4);
list.add(5);
list.add(4);
list.set(2, "b");
try {
list.set.bind({}, 3, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
list.set(8, "b");
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### convertToArray
......@@ -797,11 +692,6 @@ list.add(4);
list.add(5);
list.add(4);
let result = list.convertToArray();
try {
list.convertToArray.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### isEmpty
......@@ -835,11 +725,6 @@ list.add(4);
list.add(5);
list.add(4);
let result = list.isEmpty();
try {
list.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getFirst
......@@ -873,11 +758,6 @@ list.add(4);
list.add(5);
list.add(4);
let result = list.getFirst();
try {
list.getFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getLast
......@@ -911,11 +791,6 @@ list.add(4);
list.add(5);
list.add(4);
let result = list.getLast();
try {
list.getLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -961,9 +836,4 @@ while(temp != undefined) {
console.log("value: " + temp);
temp = iter.next().value;
}
try {
list[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -338,7 +338,7 @@ audioPlayer.stop();
reset(): void
切换播放音频资源。
重置播放音频资源。
**系统能力:** SystemCapability.Multimedia.Media.AudioPlayer
......@@ -957,7 +957,7 @@ videoPlayer.stop().then(() => {
reset(callback: AsyncCallback\<void>): void
通过回调方式切换播放视频。
通过回调方式重置播放视频。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
......@@ -983,7 +983,7 @@ videoPlayer.reset((err) => {
reset(): Promise\<void>
通过Promise方式切换播放视频。
通过Promise方式重置播放视频。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
......
......@@ -1337,9 +1337,9 @@ setData(data: PasteData): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| data | [PasteData](#pastedata) | PasteData对象。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| data | [PasteData](#pastedata) | 是 | PasteData对象。 |
**返回值:**
......@@ -1702,9 +1702,9 @@ setPasteData(data: PasteData): Promise&lt;void&gt;
**参数:**
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| data | [PasteData](#pastedata) | PasteData对象。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| data | [PasteData](#pastedata) | 是 | PasteData对象。 |
**返回值:**
......
......@@ -53,11 +53,6 @@ PlainArray的构造函数。
```ts
let plainArray = new PlainArray();
try {
let plainArray2 = PlainArray();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -88,11 +83,6 @@ isEmpty(): boolean
```ts
const plainArray = new PlainArray();
let result = plainArray.isEmpty();
try {
plainArray.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -131,11 +121,6 @@ let plainArray = new PlainArray();
plainArray.has(1);
plainArray.add(1, "squirrel");
let result1 = plainArray.has(1);
try {
plainArray.has.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -174,11 +159,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.get(1);
try {
plainArray.get.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -217,11 +197,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.getIndexOfKey(2);
try {
plainArray.getIndexOfKey.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -260,11 +235,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.getIndexOfValue("squirrel");
try {
plainArray.getIndexOfValue.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -303,11 +273,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.getKeyAt(1);
try {
plainArray.getKeyAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getValueAt
......@@ -346,16 +311,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.getValueAt(1);
try {
plainArray.getValueAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
plainArray.getValueAt(10);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### clone
......@@ -387,11 +342,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let newPlainArray = plainArray.clone();
try {
plainArray.clone.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -423,11 +373,6 @@ add(key: number, value: T): void
```ts
let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
try {
plainArray.add.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -466,11 +411,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.remove(2);
try {
plainArray.remove.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -509,11 +449,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.removeAt(1);
try {
plainArray.removeAt.bind({}, 1)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -554,16 +489,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.removeRangeFrom(1, 3);
try {
plainArray.removeRangeFrom.bind({}, 1, 3)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
plainArray.removeRangeFrom(10, 3);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -598,16 +523,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
plainArray.setValueAt(1, 3546);
try {
plainArray.setValueAt.bind({}, 1, 3546)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
try {
plainArray.setValueAt(10, 3);
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -640,11 +555,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
let result = plainArray.toString();
try {
plainArray.toString.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -671,11 +581,6 @@ let plainArray = new PlainArray();
plainArray.add(1, "squirrel");
plainArray.add(2, "sparrow");
plainArray.clear();
try {
plainArray.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -718,13 +623,6 @@ plainArray.add(2, "sparrow");
plainArray.forEach((value, index) => {
console.log("value:" + value, index);
});
try {
plainArray.forEach.bind({}, (value, index) => {
console.log("value:" + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -771,9 +669,4 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
plainArray[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -50,11 +50,6 @@ Queue的构造函数。
```ts
let queue = new Queue();
try {
let queue2 = Queue();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -96,11 +91,6 @@ let b = [1, 2, 3];
let result2 = queue.add(b);
let c = {name : "Dylon", age : "13"};
let result3 = queue.add(c);
try {
queue.add.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### pop
......@@ -135,11 +125,6 @@ queue.add(5);
queue.add(2);
queue.add(4);
let result = queue.pop();
try {
queue.pop.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### getFirst
......@@ -173,11 +158,6 @@ queue.add(4);
queue.add(5);
queue.add(2);
let result = queue.getFirst();
try {
queue.getFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -223,13 +203,6 @@ queue.add(4);
queue.forEach((value, index) => {
console.log("value:" + value, index);
});
try {
queue.forEach.bind({}, (value, index) => {
console.log("value:" + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -274,9 +247,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
queue[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -14,6 +14,29 @@ import rpc from '@ohos.rpc';
```
## ErrorCode<sup>9+</sup>
从API version 9起,IPC支持异常返回功能。错误码对应数值及含义如下。
**系统能力**:SystemCapability.Communication.IPC.Core
| 名称 | 值 | 说明 |
| ------------------------------------- | ------- | --------------------------------------------- |
| OS_MMAP_ERROR | 1900001 | 执行系统调用mmap失败。 |
| OS_IOCTL_ERROR | 1900002 | 在共享内存文件描述符上执行系统调用ioctl失败。 |
| WRITE_TO_ASHMEM_ERROR | 1900003 | 向共享内存写数据失败。 |
| READ_FROM_ASHMEM_ERROR | 1900004 | 从共享内存读数据失败。 |
| ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | 只有proxy对象允许该操作。 |
| ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | 只有remote对象允许该操作。 |
| COMMUNICATION_ERROR | 1900007 | 和远端对象进行进程间通信失败。 |
| PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | 非法的代理对象或者远端对象。 |
| WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | 向MessageSequence写数据失败。 |
| READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | 读取MessageSequence数据失败。 |
| PARCEL_MEMORY_ALLOC_ERROR | 1900011 | 序列化过程中内存分配失败。 |
| CALL_JS_METHOD_ERROR | 1900012 | 执行JS回调方法失败。 |
| OS_DUP_ERROR | 1900013 | 执行系统调用dup失败。 |
## MessageSequence<sup>9+</sup>
在RPC过程中,发送方可以使用MessageSequence提供的写方法,将待发送的数据以特定格式写入该对象。接收方可以使用MessageSequence提供的读方法从该对象中读取特定格式的数据。数据格式包括:基础类型及数组、IPC对象、接口描述符和自定义序列化对象。
......@@ -796,7 +819,7 @@ writeFloat(val: number): void
| 错误码ID | 错误信息 |
| ------- | ------- |
| 1900010 | write data to message sequence failed |
| 1900009 | write data to message sequence failed |
**示例:**
......@@ -2543,6 +2566,7 @@ writeRemoteObjectArray(objectArray: IRemoteObject[]): void
**系统能力**:SystemCapability.Communication.IPC.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------- | ---- | ---------------------------------------------- |
| objectArray | IRemoteObject[] | 是 | 要写入MessageSequence的IRemoteObject对象数组。 |
......@@ -2681,7 +2705,7 @@ readRemoteObjectArray(): IRemoteObject[]
```
### closeFileDescriptor<sup>8+</sup>
### closeFileDescriptor<sup>9+</sup>
static closeFileDescriptor(fd: number): void
......@@ -2891,7 +2915,7 @@ writeAshmem(ashmem: Ashmem): void
| 错误码ID | 错误信息 |
| ------- | ------- |
| 1900009 | write data to message sequence failed |
| 1900003 | write data to message sequence failed |
**示例:**
......@@ -2933,7 +2957,7 @@ readAshmem(): Ashmem
| 错误码ID | 错误信息 |
| ------- | -------- |
| 1900010 | read data from message sequence failed |
| 1900004 | read data from message sequence failed |
**示例:**
......@@ -5738,12 +5762,12 @@ onRemoteDied(): void
**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------- | ---- | ------------------------------------- |
| errCode | number | 是 | 错误码。 |
| code | number | 是 | 消息代码。 |
| data | MessageSequence | 是 | 发送给对端进程的MessageSequence对象。 |
| reply | MessageSequence | 是 | 对端进程返回的MessageSequence对象。 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | --------------- | ---- | ---- |-------------------------------------- |
| errCode | number | 是 | 否 | 错误码。 |
| code | number | 是 | 否 | 消息代码。 |
| data | MessageSequence | 是 | 否 | 发送给对端进程的MessageSequence对象。 |
| reply | MessageSequence | 是 | 否 | 对端进程返回的MessageSequence对象。 |
## SendRequestResult<sup>8+(deprecated)</sup>
......@@ -5753,12 +5777,12 @@ onRemoteDied(): void
**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------- | ---- | ----------------------------------- |
| errCode | number | 是 | 错误码。 |
| code | number | 是 | 消息代码。 |
| data | MessageParcel | 是 | 发送给对端进程的MessageParcel对象。 |
| reply | MessageParcel | 是 | 对端进程返回的MessageParcel对象。 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------------- | ---- | ---- | ----------------------------------- |
| errCode | number | 是 | 否 | 错误码。 |
| code | number | 是 | 否 | 消息代码。 |
| data | MessageParcel | 是 | 否 | 发送给对端进程的MessageParcel对象。 |
| reply | MessageParcel | 是 | 否 | 对端进程返回的MessageParcel对象。 |
## IRemoteObject
......@@ -5973,7 +5997,7 @@ addDeathRecipient(recipient: DeathRecipient, flags: number): boolean
### unregisterDeathRecipient<sup>9+</sup>
removeDeathRecipient(recipient: DeathRecipient, flags: number): void
unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void
注销用于接收远程对象死亡通知的回调。
......
......@@ -18,9 +18,6 @@ Stack和[Queue](js-apis-queue.md)相比,Queue基于循环队列实现,只能
import Stack from '@ohos.util.Stack';
```
## Stack
### 属性
......@@ -52,11 +49,6 @@ Stack的构造函数。
```ts
let stack = new Stack();
try {
let stack2 = Stack();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -98,11 +90,6 @@ let b = [1, 2, 3];
let result2 = stack.push(b);
let c = {name : "Dylon", age : "13"};
let result3 = stack.push(c);
try {
stack.push.bind({}, "b")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### pop
......@@ -137,11 +124,6 @@ stack.push(5);
stack.push(2);
stack.push(4);
let result = stack.pop();
try {
stack.pop.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### peek
......@@ -175,11 +157,6 @@ stack.push(4);
stack.push(5);
stack.push(2);
let result = stack.peek();
try {
stack.peek.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### locate
......@@ -219,11 +196,6 @@ stack.push(4);
stack.push(5);
stack.push(2);
let result = stack.locate(2);
try {
stack.locate.bind({}, 2)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### forEach
......@@ -269,13 +241,6 @@ stack.push(4);
stack.forEach((value, index) => {
console.log("value:" + value, index);
});
try {
stack.forEach.bind({}, (value, index) => {
console.log("value:" + value, index);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### isEmpty
......@@ -309,11 +274,6 @@ stack.push(4);
stack.push(5);
stack.push(4);
let result = stack.isEmpty();
try {
stack.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### [Symbol.iterator]
......@@ -358,9 +318,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
stack[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -8,7 +8,7 @@
## 导入模块
```js
import deviceStatus from '@ohos.devicestatus'
import stationary from '@ohos.stationary'
```
## ActivityResponse
......@@ -57,7 +57,7 @@ import deviceStatus from '@ohos.devicestatus'
| ENTER | 1 | 进入。 |
| EXIT | 2 | 退出。 |
## deviceStatus.on('still' | 'relativeStill')
## stationary.on('still' | 'relativeStill')
on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback&lt;ActivityResponse&gt;): void
......@@ -78,12 +78,12 @@ on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callba
```js
var reportLatencyNs = 100;
deviceStatus.on('still', deviceStatus.ActivityEvent.ENTER, reportLatencyNs, (data) => {
stationary.on('still', stationary.ActivityEvent.ENTER, reportLatencyNs, (data) => {
console.log('data='+ JSON.stringify(data));
})
```
## deviceStatus.once('still' | 'relativeStill')
## stationary.once('still' | 'relativeStill')
once(activity: ActivityType, callback: Callback&lt;ActivityResponse&gt;): void
......@@ -101,12 +101,12 @@ once(activity: ActivityType, callback: Callback&lt;ActivityResponse&gt;): void
**示例:**
```js
deviceStatus.once('still', (data) => {
stationary.once('still', (data) => {
console.log("data="+ JSON.stringify(data));
})
```
## deviceStatus.off('still' | 'relativeStill')
## stationary.off('still' | 'relativeStill')
off(activity: ActivityType, event: ActivityEvent, callback?: Callback&lt;ActivityResponse&gt;): void
......@@ -125,5 +125,5 @@ off(activity: ActivityType, event: ActivityEvent, callback?: Callback&lt;Activit
**示例:**
```js
deviceStatus.off('still', deviceStatus.ActivityEvent.ENTER);
stationary.off('still', stationary.ActivityEvent.ENTER);
```
......@@ -164,7 +164,7 @@ setSync(key: string, value: string): void
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 此接口只能用于系统应用的参数设置。
> - 所授权的系统应用需要配置对应selinux和dac规则,具体配置方法请参照系统参数指导文档:[系统参数](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-boot-init-sysparam.md)。
> - 所授权的系统应用需要配置对应selinux和dac规则,具体配置方法请参照系统参数指导文档:[系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。
**示例:**
......
......@@ -58,11 +58,6 @@ TreeMap的构造函数。
```ts
let treeMap = new TreeMap();
try {
let treeMap2 = TreeMap();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -93,11 +88,6 @@ isEmpty(): boolean
```ts
const treeMap = new TreeMap();
let result = treeMap.isEmpty();
try {
treeMap.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -136,11 +126,6 @@ let treeMap = new TreeMap();
let result = treeMap.hasKey("squirrel");
treeMap.set("squirrel", 123);
let result1 = treeMap.hasKey("squirrel");
try {
treeMap.hasKey.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -179,11 +164,6 @@ let treeMap = new TreeMap();
let result = treeMap.hasValue(123);
treeMap.set("squirrel", 123);
let result1 = treeMap.hasValue(123);
try {
treeMap.hasValue.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -222,11 +202,6 @@ let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let result = treeMap.get("sparrow");
try {
treeMap.get.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -259,11 +234,6 @@ let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let result = treeMap.getFirstKey();
try {
treeMap.getFirstKey.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -296,11 +266,6 @@ let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let result = treeMap.getLastKey();
try {
treeMap.getLastKey.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -334,11 +299,6 @@ treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
let map = new TreeMap();
treeMap.setAll(map);
try {
treeMap.setAll.bind({}, map)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -376,11 +336,6 @@ set(key: K, value: V): Object
```ts
let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
try {
treeMap.set.bind({}, "squirrel", 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -419,11 +374,6 @@ let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
treeMap.remove("sparrow");
try {
treeMap.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -463,11 +413,6 @@ treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
treeMap.set("gander", 356);
let result = treeMap.getLowerKey("sparrow");
try {
treeMap.getLowerKey.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -507,11 +452,6 @@ treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
treeMap.set("gander", 356);
let result = treeMap.getHigherKey("sparrow");
try {
treeMap.getHigherKey.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
### replace
......@@ -549,11 +489,6 @@ replace(key: K, newValue: V): boolean
let treeMap = new TreeMap();
treeMap.set("sparrow", 123);
let result = treeMap.replace("sparrow", 357);
try {
treeMap.replace.bind({}, "sparrow", 357)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -580,11 +515,6 @@ let treeMap = new TreeMap();
treeMap.set("squirrel", 123);
treeMap.set("sparrow", 356);
treeMap.clear();
try {
treeMap.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -622,11 +552,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
treeMap.keys.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -664,11 +589,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
treeMap.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -711,13 +631,6 @@ treeMap.set("gull", 357);
treeMap.forEach((value, key) => {
console.log("value:" + value, key);
});
try {
treeMap.forEach.bind({}, (value, key) => {
console.log("value:" + value, key);
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -756,11 +669,6 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
treeMap.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -806,9 +714,4 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
treeMap[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
......@@ -55,11 +55,6 @@ TreeSet的构造函数。
```ts
let treeSet = new TreeSet();
try {
let treeSet2 = TreeSet();
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -90,11 +85,6 @@ isEmpty(): boolean
```ts
const treeSet = new TreeSet();
let result = treeSet.isEmpty();
try {
treeSet.isEmpty.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -133,11 +123,6 @@ let treeSet = new TreeSet();
treeSet.has(123);
treeSet.add(123);
let result1 = treeSet.has(123);
try {
treeSet.has.bind({}, 123)(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -170,11 +155,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.getFirstValue();
try {
treeSet.getFirstValue.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -207,11 +187,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.getLastValue();
try {
treeSet.getLastValue.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -248,11 +223,6 @@ add(value: T): boolean
```ts
let treeSet = new TreeSet();
let result = treeSet.add("squirrel");
try {
treeSet.add.bind({}, "squirrel")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -291,11 +261,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.remove("sparrow");
try {
treeSet.remove.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -335,11 +300,6 @@ treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.add("gander");
let result = treeSet.getLowerValue("sparrow");
try {
treeSet.getLowerValue.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -379,11 +339,6 @@ treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.add("gander");
let result = treeSet.getHigherValue("sparrow");
try {
treeSet.getHigherValue.bind({}, "sparrow")(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -416,11 +371,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.popFirst();
try {
treeSet.popFirst.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -453,11 +403,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.popLast();
try {
treeSet.popLast.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -484,11 +429,6 @@ let treeSet = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.clear();
try {
treeSet.clear.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -526,11 +466,6 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
treeSet.values.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -573,13 +508,6 @@ treeSet.add("gull");
treeSet.forEach((value, key) => {
console.log("value:" + value, key)
});
try {
treeSet.forEach.bind({}, (value, key) => {
console.log("value:" + value, key)
})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -618,11 +546,6 @@ while(temp != undefined) {
console.log("value:" + temp[1]);
temp = iter.next().value;
}
try {
treeSet.entries.bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
......@@ -667,9 +590,4 @@ while(temp != undefined) {
console.log("value:" + temp);
temp = iter.next().value;
}
try {
treeSet[Symbol.iterator].bind({})(); // bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
} catch(err) {
console.log(`${err.code} - ${err.name} - ${err.message}`);
}
```
\ No newline at end of file
# URI字符串解析
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -16,7 +17,7 @@ import uri from '@ohos.uri'
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| scheme | string | 是 | 否 | 获取URI&nbsp;的协议部分。 |
| userInfo | string | 是 | 否 | 获取&nbsp;URI&nbsp;的用户信息部分。 |
......@@ -39,9 +40,9 @@ constructor是URI的构造函数。
**参数:**
| 参数名 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| uri | string | 是 | 是 | 入参对象。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 入参对象。 |
**示例:**
......@@ -77,8 +78,10 @@ result.toString()
### equals<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[equalsTo<sup>9+</sup>](#equalsto9)替代。
> **说明:**
>
> 从API version 8开始支持,从API version 9开始废弃,建议使用[equalsTo<sup>9+</sup>](#equalsto9)替代。
equals(other: URI): boolean
......@@ -170,6 +173,7 @@ normalize(): URI
| URI | 返回一个path被规范化后的URI对象。 |
**示例:**
```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize();
......
......@@ -56,7 +56,7 @@ setSurfaceId(surfaceId: string): void;
| -------------- | ---------------------------------- | ---- | -------------------------- |
| surfaceId | string | 是 | [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) 持有 Surface 的 ID。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......
......@@ -144,7 +144,7 @@ on : (name : AuthEventKey, callback : AuthEvent) => void
| name | [AuthEventKey](#autheventkey9) | 是 | 表示认证事件类型,取值为"result"时,回调函数返回认证结果;取值为"tip"时,回调函数返回认证过程中的提示信息。 |
| callback | [AuthEvent](#authevent9) | 是 | 认证接口的回调函数,用于返回认证结果或认证过程中的提示信息。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -208,7 +208,7 @@ off : (name : AuthEventKey) => void
| --------- | -------------------------- | ---- | ------------------------- |
| name | [AuthEventKey](#autheventkey9) | 是 | 表示认证事件类型,取值为"result"时,取消订阅认证结果;取值为"tip"时,取消订阅认证过程中的提示信息。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -269,7 +269,7 @@ start : () => void
**系统能力**:SystemCapability.UserIAM.UserAuth.Core
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -313,7 +313,7 @@ cancel : () => void
**系统能力**:SystemCapability.UserIAM.UserAuth.Core
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -366,7 +366,7 @@ getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel
| ----------------------------------------- | ------------ |
| [AuthInstance](#authinstance9) | 认证器对象。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -410,7 +410,7 @@ getVersion(): number
| ------ | ---------------------- |
| number | 认证器版本信息。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......@@ -449,7 +449,7 @@ getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): vo
| authType | [UserAuthType](#userauthtype8) | 是 | 认证类型,当前只支持FACE。 |
| authTrustLevel | [AuthTrustLevel](#authtrustlevel8) | 是 | 认证信任等级。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md)
**错误码:**
......
......@@ -16,7 +16,7 @@ import worker from '@ohos.worker';
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------------------------- | --------------------------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| workerPort<sup>9+</sup> | [ThreadWorkerGlobalScope](#threadworkerglobalscope9) | 是 | 是 | worker线程用于与宿主线程通信的对象。 |
| parentPort<sup>(deprecated)</sup> | [DedicatedWorkerGlobalScope](#dedicatedworkerglobalscope) | 是 | 是 | worker线程用于与宿主线程通信的对象。<br/>此属性从api9开始被废弃,建议使用workerPort<sup>9+</sup>。 |
......@@ -28,7 +28,7 @@ Worker构造函数的选项信息,用于为Worker添加其他信息。
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | -------- | ---- | ---- | -------------- |
| type | classic \| module | 是 | 是 | Worker执行脚本的模式类型,默认为classic类型,暂不支持module类型。 |
| name | string | 是 | 是 | Worker的名称。 |
......@@ -617,7 +617,7 @@ Worker线程自身的运行环境,GlobalScope类继承[WorkerEventTarget](#wor
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------- |
| name | string | 是 | 否 | Worker的名字,new&nbsp;Worker时指定。 |
| self | [GlobalScope](#globalscope9)&nbsp;&amp;&nbsp;typeof&nbsp;globalThis | 是 | 否 | GlobalScope本身。 |
......@@ -1253,7 +1253,7 @@ parentPort.onmessageerror= function(e) {
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | ---- | ---- | --------------------------------- |
| transfer | Object[] | 是 | 是 | ArrayBuffer数组,用于传递所有权。 |
......@@ -1264,7 +1264,7 @@ parentPort.onmessageerror= function(e) {
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------- | -------- | ---- | ---- | ---------------------------------- |
| type | string | 是 | 否 | 指定事件的类型。 |
| timeStamp | number | 是 | 否 | 事件创建时的时间戳(精度为毫秒)。 |
......@@ -1309,7 +1309,7 @@ workerInstance.addEventListener("alert", (e)=>{
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | ---- | ---- | -------------------- |
| message | string | 是 | 否 | 异常发生的错误信息。 |
| filename | string | 是 | 否 | 出现异常所在的文件。 |
......@@ -1324,7 +1324,7 @@ workerInstance.addEventListener("alert", (e)=>{
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | -------- | ---- | ---- | ------------------ |
| data | T | 是 | 否 | 线程间传递的数据。 |
......@@ -1340,7 +1340,7 @@ Worker线程自身的运行环境,WorkerGlobalScope类继承[EventTarget](#eve
**系统能力:** SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------- |
| name | string | 是 | 否 | Worker的名字,new&nbsp;Worker时指定。 |
| self | [WorkerGlobalScope](#workerglobalscope)&nbsp;&amp;&nbsp;typeof&nbsp;globalThis | 是 | 否 | WorkerGlobalScope本身。 |
......
......@@ -24,8 +24,8 @@ XmlSerializer的构造函数。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 用于接收写入xml信息的ArrayBuffer或DataView内存。 |
| -------- | --------------------------------- | ---- | ------------------------------------------------ |
| buffer | ArrayBuffer \| DataView | 是 | 用于接收写入xml信息的ArrayBuffer或DataView内存。 |
| encoding | string | 否 | 编码格式。 |
**示例:**
......@@ -48,7 +48,7 @@ setAttributes(name: string, value: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | --------------- |
| name | string | 是 | 属性的key值。 |
| value | string | 是 | 属性的value值。 |
......@@ -75,7 +75,7 @@ addEmptyElement(name: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------------------ |
| name | string | 是 | 该空元素的元素名。 |
**示例:**
......@@ -117,7 +117,7 @@ startElement(name: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------------------ |
| name | string | 是 | 当前元素的元素名。 |
**示例:**
......@@ -163,7 +163,7 @@ setNamespace(prefix: string, namespace: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| --------- | ------ | ---- | ------------------------------ |
| prefix | string | 是 | 当前元素及其子元素的前缀。 |
| namespace | string | 是 | 当前元素及其子元素的命名空间。 |
......@@ -189,7 +189,7 @@ setComment(text: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | -------------------- |
| text | string | 是 | 当前元素的注释内容。 |
**示例:**
......@@ -214,7 +214,7 @@ setCDATA(text: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ----------------- |
| text | string | 是 | CDATA属性的内容。 |
**示例:**
......@@ -237,7 +237,7 @@ setText(text: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ---------------- |
| text | string | 是 | text属性的内容。 |
**示例:**
......@@ -263,7 +263,7 @@ setDocType(text: string): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ------ | ---- | ------------------- |
| text | string | 是 | DocType属性的内容。 |
**示例:**
......@@ -289,8 +289,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 |
| -------- | --------------------------------- | ---- | ------------------------------------------ |
| buffer | ArrayBuffer \| DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 |
| encoding | string | 否 | 编码格式(仅支持utf-8)。 |
**示例:**
......@@ -324,7 +324,7 @@ parse(option: ParseOptions): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ------ | ----------------------------- | ---- | -------------------------------- |
| option | [ParseOptions](#parseoptions) | 是 | 用户控制以及获取解析信息的选项。 |
**示例:**
......@@ -372,12 +372,12 @@ xml解析选项。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| supportDoctype | boolean | 否 | 是否忽略Doctype&nbsp;,&nbsp;默认false。 |
| ------------------------------ | ------------------------------------------------------------ | ---- | --------------------------------------- |
| supportDoctype | boolean | 否 | 是否忽略Doctype , 默认false。 |
| ignoreNameSpace | boolean | 否 | 是否忽略NameSpace,默认false。 |
| tagValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取tagValue回调函数。 |
| attributeValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取attributeValue回调函数。 |
| tokenValueCallbackFunction | (eventType:&nbsp;[EventType](#eventtype),&nbsp;value:&nbsp;[ParseInfo](#parseinfo))=&gt;&nbsp;boolean | 否 | 获取tokenValue回调函数。 |
| tagValueCallbackFunction | (name: string, value: string) =&gt; boolean | 否 | 获取tagValue回调函数。 |
| attributeValueCallbackFunction | (name: string, value: string) =&gt; boolean | 否 | 获取attributeValue回调函数。 |
| tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo)) =&gt; boolean | 否 | 获取tokenValue回调函数。 |
## ParseInfo
......@@ -395,7 +395,7 @@ getColumnNumber(): number
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | -------------- |
| number | 返回当前列号。 |
......@@ -410,7 +410,7 @@ getDepth(): number
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | -------------------- |
| number | 返回元素的当前深度。 |
......@@ -425,7 +425,7 @@ getLineNumber(): number
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | -------------- |
| number | 返回当前行号。 |
......@@ -440,7 +440,7 @@ getName(): string
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ------------------ |
| string | 返回当前元素名称。 |
......@@ -455,7 +455,7 @@ getNamespace(): string
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ------------------------ |
| string | 返回当前元素的命名空间。 |
......@@ -470,7 +470,7 @@ getPrefix(): string
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ------------------ |
| string | 返回当前元素前缀。 |
......@@ -485,7 +485,7 @@ getText(): string
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ------------------------ |
| string | 返回当前事件的文本内容。 |
......@@ -500,7 +500,7 @@ isEmptyElementTag(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | ---------------------------- |
| boolean | 返回true,当前元素为空元素。 |
......@@ -515,7 +515,7 @@ isWhitespace(): boolean
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------- | -------------------------------------- |
| boolean | 返回true,当前文本事件仅包含空格字符。 |
......@@ -529,7 +529,7 @@ getAttributeCount(): number
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------ | ---------------------- |
| number | 当前开始标记的属性数。 |
......@@ -539,8 +539,8 @@ getAttributeCount(): number
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 枚举值 | 说明 |
| -------- | -------- | -------- |
| 名称 | 值 | 说明 |
| ---------------- | ---- | --------------------- |
| START_DOCUMENT | 0 | 启动文件事件。 |
| END_DOCUMENT | 1 | 结束文件事件。 |
| START_TAG | 2 | 启动标签事件。 |
......
......@@ -320,7 +320,7 @@ try {
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ---------------- | ---- | ---- | ---------------------------------------------------------- |
| level | CompressLeve | 是 | 否 | 参考[zip.CompressLevel枚举定义](#zipcompresslevel)。 |
| level | CompressLevel | 是 | 否 | 参考[zip.CompressLevel枚举定义](#zipcompresslevel)。 |
| memLevel | MemLevel | 是 | 否 | 参考[zip.MemLevel枚举定义](#zipmemlevel)。 |
| strategy | CompressStrategy | 是 | 否 | 参考[zip.CompressStrategy枚举定义](#zipcompressstrategy)。 |
......
......@@ -92,8 +92,6 @@
- [animate](js-components-svg-animate.md)
- [animateMotion](js-components-svg-animatemotion.md)
- [animateTransform](js-components-svg-animatetransform.md)
- 自定义组件
- [基本用法](js-components-custom-basic-usage.md)
- [数据传递与处理](js-components-custom-props.md)
......
......@@ -37,7 +37,7 @@ Checkbox(options?:&nbsp;{name?: string, group?: string })
| 名称 | 功能描述 |
| ----------| -------- |
|onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。<br>- value为true时,表示已选中。<br>- value为false时,表示未选中。 |
|onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。(只有手动触发且Checkbox状态改变时才会触发onChange回调)<br>- value为true时,表示已选中。<br>- value为false时,表示未选中。 |
## 示例
......
......@@ -39,7 +39,7 @@ CheckboxGroup(options?: { group?: string })
| 名称 | 功能描述 |
| -------- | -------- |
| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。|
| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。(只有手动触发且Checkbox或CheckboxGroup状态改变时才会触发onChange回调)|
## CheckboxGroupResult对象说明
| 名称 | 类型 | 描述 |
......
......@@ -25,9 +25,9 @@ Web(options: { src: ResourceStr, controller: WebController | WebviewController})
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ---------- | ------------------------------- | ---- | ------- |
| ---------- | ---------------------------------------- | ---- | ------- |
| src | [ResourceStr](ts-types.md) | 是 | 网页资源地址。 |
| controller | [WebController](#webcontroller)[WebviewController](../apis/js-apis-webview.md#webviewcontroller) |是 | 控制器。 |
| controller | [WebController](#webcontroller)[WebviewController](../apis/js-apis-webview.md#webviewcontroller) | 是 | 控制器。 |
**示例:**
......@@ -99,7 +99,7 @@ domStorageAccess(domStorageAccess: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---------------- | ------- | ---- | ---- | ------------------------------------ |
| ---------------- | ------- | ---- | ----- | ------------------------------------ |
| domStorageAccess | boolean | 是 | false | 设置是否开启文档对象模型存储接口(DOM Storage API)权限。 |
**示例:**
......@@ -128,7 +128,7 @@ fileAccess(fileAccess: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---------- | ------- | ---- | ---- | ---------------------------------------- |
| ---------- | ------- | ---- | ---- | ---------------------- |
| fileAccess | boolean | 是 | true | 设置是否开启应用中文件系统的访问,默认启用。 |
**示例:**
......@@ -186,7 +186,7 @@ javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Arr
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---------- | --------------- | ---- | ---- | ------------------------- |
| ---------- | ---------------------------------------- | ---- | ---- | ------------------------- |
| object | object | 是 | - | 参与注册的对象。只能声明方法,不能声明属性。 |
| name | string | 是 | - | 注册对象的名称,与window中调用的对象名一致。 |
| methodList | Array\<string\> | 是 | - | 参与注册的应用侧JavaScript对象的方法。 |
......@@ -297,7 +297,7 @@ mixedMode(mixedMode: MixedMode)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | --------------------------- | ---- | ---- | --------- |
| --------- | --------------------------- | ---- | -------------- | --------- |
| mixedMode | [MixedMode](#mixedmode枚举说明) | 是 | MixedMode.None | 要设置的混合内容。 |
**示例:**
......@@ -414,7 +414,7 @@ databaseAccess(databaseAccess: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------------- | ------- | ---- | ---- | ----------------- |
| -------------- | ------- | ---- | ----- | ----------------- |
| databaseAccess | boolean | 是 | false | 设置是否开启数据库存储API权限。 |
**示例:**
......@@ -443,7 +443,7 @@ geolocationAccess(geolocationAccess: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------------- | ------- | ---- | ---- | ----------------- |
| ----------------- | ------- | ---- | ---- | --------------- |
| geolocationAccess | boolean | 是 | true | 设置是否开启获取地理位置权限。 |
**示例:**
......@@ -472,7 +472,7 @@ mediaPlayGestureAccess(access: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | ------ | ---- | ---- | --------- |
| ------ | ------- | ---- | ---- | ----------------- |
| access | boolean | 是 | true | 设置视频播放是否需要用户手动点击。 |
**示例:**
......@@ -502,7 +502,7 @@ multiWindowAccess(multiWindow: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------------- | ------- | ---- | ---- | ----------------- |
| ----------- | ------- | ---- | ----- | ------------ |
| multiWindow | boolean | 是 | false | 设置是否开启多窗口权限。 |
**示例:**
......@@ -531,7 +531,7 @@ cacheMode(cacheMode: CacheMode)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | --------------------------- | ---- | ---- | --------- |
| --------- | --------------------------- | ---- | ----------------- | --------- |
| cacheMode | [CacheMode](#cachemode枚举说明) | 是 | CacheMode.Default | 要设置的缓存模式。 |
**示例:**
......@@ -561,7 +561,7 @@ textZoomRatio(textZoomRatio: number)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ------------ | ------ | ---- | ---- | --------------- |
| ------------- | ------ | ---- | ---- | --------------- |
| textZoomRatio | number | 是 | 100 | 要设置的页面的文本缩放百分比。 |
**示例:**
......@@ -591,7 +591,7 @@ initialScale(percent: number)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ------------ | ------ | ---- | ---- | --------------- |
| ------- | ------ | ---- | ---- | --------------- |
| percent | number | 是 | 100 | 要设置的整体页面的缩放百分比。 |
**示例:**
......@@ -651,7 +651,7 @@ webDebuggingAccess(webDebuggingAccess: boolean)
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | ------ | ---- | ---- | --------- |
| ------------------ | ------- | ---- | ----- | ------------- |
| webDebuggingAccess | boolean | 是 | false | 设置是否启用网页调试功能。 |
**示例:**
......@@ -1234,7 +1234,7 @@ onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------- | --------------------------------- |
| ----------- | ------- | ---------------------------------------- |
| url | string | 访问的url。 |
| isRefreshed | boolean | true表示该页面是被重新加载的(调用[refresh](#refresh)接口),false表示该页面是新加载的。 |
......@@ -1306,7 +1306,7 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
**返回值:**
| 类型 | 说明 |
| ------- | ----------------------------------- |
| ------- | ---------------------------------------- |
| boolean | 当返回值为true时,用户可以调用系统提供的弹窗能力。当返回值为false时,触发Web默认弹窗。 |
**示例:**
......@@ -1355,7 +1355,7 @@ onResourceLoad(callback: (event: {url: string}) => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ---- | ---------------------------------------- | --------- |
| ---- | ------ | -------------- |
| url | string | 所加载的资源文件url信息。 |
**示例:**
......@@ -1387,7 +1387,7 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ---- | ---------------------------------------- | --------- |
| -------- | ------ | ------------ |
| oldScale | number | 变化前的显示比例百分比。 |
| newScale | number | 变化后的显示比例百分比。 |
......@@ -1465,7 +1465,7 @@ onInterceptRequest(callback: (event?: { request: WebResourceRequest}) => WebReso
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | --------------------------- |
| ---------------------------------------- | ---------------------------------------- |
| [WebResourceResponse](#webresourceresponse) | 返回响应数据则按照响应数据加载,无响应数据则返回null表示按照原来的方式加载。 |
**示例:**
......@@ -1593,7 +1593,7 @@ onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslE
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------------------------------------ | ---------------- |
| ------- | ------------------------------------ | -------------- |
| handler | [SslErrorHandler](#sslerrorhandler9) | 通知Web组件用户操作行为。 |
| error | [SslError](#sslerror9枚举说明) | 错误码。 |
......@@ -1646,12 +1646,12 @@ onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationH
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------------------------------------ | ---------------- |
| handler | [ClientAuthenticationHandler](#clientauthenticationhandler9) | 通知Web组件用户操作行为。|
| -------- | ---------------------------------------- | --------------- |
| handler | [ClientAuthenticationHandler](#clientauthenticationhandler9) | 通知Web组件用户操作行为。 |
| host | string | 请求证书服务器的主机名。 |
| port | number | 请求证书服务器的端口号。 |
| keyTypes| Array<string> | 可接受的非对称秘钥类型。 |
| issuers | Array<string> | 与私钥匹配的证书可接受颁发者。|
| keyTypes | Array<string> | 可接受的非对称秘钥类型。 |
| issuers | Array<string> | 与私钥匹配的证书可接受颁发者。 |
**示例:**
```ts
......@@ -1701,7 +1701,7 @@ onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------------------------------------ | ---------------- |
| ------- | ---------------------------------------- | -------------- |
| request | [PermissionRequest](#permissionrequest9) | 通知Web组件用户操作行为。 |
**示例:**
......@@ -1750,14 +1750,14 @@ onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebCo
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------------------------------------ | ---------------- |
| ------ | ---------------------------------------- | ----------- |
| param | [WebContextMenuParam](#webcontextmenuparam9) | 菜单相关参数。 |
| result | [WebContextMenuResult](#webcontextmenuresult9) | 菜单相应事件传入内核。 |
**返回值:**
| 类型 | 说明 |
| ------ | -------------------- |
| ------- | ------------------------ |
| boolean | 自定义菜单返回true,默认菜单返回false。 |
**示例:**
......@@ -1790,7 +1790,7 @@ onScroll(callback: (event: {xOffset: number, yOffset: number}) => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------- | ------------------------------------ | ---------------- |
| ------- | ------ | ------------ |
| xOffset | number | 水平滚动条滚动所在位置。 |
| yOffset | number | 竖直滚动条滚动所在位置。 |
......@@ -1823,9 +1823,9 @@ onGeolocationShow(callback: (event?: { origin: string, geolocation: JsGeolocatio
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| ----------- | ------------------------------- | -------------- |
| origin | string | 指定源的字符串索引。 |
| geolocation | [JsGeolocation](#jsgeolocation) | 通知Web组件用户操作行为。|
| geolocation | [JsGeolocation](#jsgeolocation) | 通知Web组件用户操作行为。 |
**示例:**
......@@ -1868,7 +1868,7 @@ onGeolocationHide(callback: () => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| -------- | ---------- | -------------------- |
| callback | () => void | 地理位置信息获取请求已被取消的回调函数。 |
**示例:**
......@@ -1900,7 +1900,7 @@ onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler }) => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| ------- | ---------------------------------------- | -------------- |
| handler | [FullScreenExitHandler](#fullscreenexithandler9) | 用于退出全屏模式的函数句柄。 |
**示例:**
......@@ -1933,7 +1933,7 @@ onFullScreenExit(callback: () => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| -------- | ---------- | ------------- |
| callback | () => void | 退出全屏模式时的回调函数。 |
**示例:**
......@@ -1969,7 +1969,7 @@ onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetU
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| ------------- | ---------------------------------------- | -------------------------- |
| isAlert | boolean | true代表请求创建对话框,false代表新标签页。 |
| isUserTrigger | boolean | true代表用户触发,false代表非用户触发。 |
| targetUrl | string | 目标url。 |
......@@ -2006,7 +2006,7 @@ onWindowExit(callback: () => void)
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ----------- | ------------------------------- | ---------------- |
| -------- | ---------- | ------------ |
| callback | () => void | 窗口请求关闭的回调函数。 |
**示例:**
......@@ -2037,7 +2037,7 @@ onSearchResultReceive(callback: (event?: {activeMatchOrdinal: number, numberOfMa
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------------------ | ------------- | ----------------------------------- |
| ------------------ | ------- | ---------------------------------------- |
| activeMatchOrdinal | number | 当前匹配的查找项的序号(从0开始)。 |
| numberOfMatches | number | 所有匹配到的关键词的个数。 |
| isDoneCounting | boolean | 当次页内查找操作是否结束。该方法可能会回调多次,直到isDoneCounting为true为止。 |
......@@ -2166,7 +2166,7 @@ setWebController(controller: WebController): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ------ | ------ | ---- | ---- | ----------- |
| ---------- | ------------- | ---- | ---- | ------------------------- |
| controller | WebController | 是 | - | 新建web组件的的WebController对象。 |
## WebResourceError
......@@ -2557,9 +2557,9 @@ confirm(priKeyFile : string, certChainFile : string): void
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | ------ | ---- | ---------- |
| priKeyFile | string | 是 | 存放私钥的文件,包含路径和文件名。|
| certChainFile | string | 是 | 存放证书链的文件,包含路径和文件名。|
| ------------- | ------ | ---- | ------------------ |
| priKeyFile | string | 是 | 存放私钥的文件,包含路径和文件名。 |
| certChainFile | string | 是 | 存放证书链的文件,包含路径和文件名。 |
### cancel<sup>9+</sup>
......@@ -2592,7 +2592,7 @@ getOrigin(): string
**返回值:**
| 类型 | 说明 |
| ------- | --------------------- |
| ------ | ------------ |
| string | 当前请求权限网页的来源。 |
### getAccessibleResource<sup>9+</sup>
......@@ -2604,7 +2604,7 @@ getAccessibleResource(): Array\<string\>
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| --------------- | ------------- |
| Array\<string\> | 网页所请求的权限资源列表。 |
### grant<sup>9+</sup>
......@@ -2616,8 +2616,8 @@ grant(resources: Array\<string\>): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | --------------- | ---- | ----- | ---------------------- |
| resources | Array\<string\> | 是 | - | 网页所请求的权限资源列表。|
| --------- | --------------- | ---- | ---- | ------------- |
| resources | Array\<string\> | 是 | - | 网页所请求的权限资源列表。 |
## WebContextMenuParam<sup>9+</sup>
......@@ -2632,7 +2632,7 @@ x(): number
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------ | ------------------ |
| number | 显示正常返回非负整数,否则返回-1。 |
### y<sup>9+</sup>
......@@ -2644,7 +2644,7 @@ y(): number
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------ | ------------------ |
| number | 显示正常返回非负整数,否则返回-1。 |
### getLinkUrl<sup>9+</sup>
......@@ -2656,7 +2656,7 @@ getLinkUrl(): string
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------ | ------------------------- |
| string | 如果长按位置是链接,返回经过安全检查的url链接。 |
### getUnfilterendLinkUrl<sup>9+</sup>
......@@ -2668,7 +2668,7 @@ getUnfilterendLinkUrl(): string
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------ | --------------------- |
| string | 如果长按位置是链接,返回原始的url链接。 |
### getSourceUrl<sup>9+</sup>
......@@ -2680,7 +2680,7 @@ getSourceUrl(): string
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------ | ------------------------ |
| string | 如果选中的元素有src属性,返回src的url。 |
### existsImageContents<sup>9+</sup>
......@@ -2692,7 +2692,7 @@ existsImageContents(): boolean
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| ------- | ------------------------- |
| boolean | 长按位置中有图片返回true,否则返回false。 |
## WebContextMenuResult<sup>9+</sup>
......@@ -2724,7 +2724,7 @@ invoke(origin: string, allow: boolean, retain: boolean): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| --------- | ------- | ---- | ----- | ---------------------- |
| ------ | ------- | ---- | ---- | ---------------------------------------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
| allow | boolean | 是 | - | 设置的地理位置权限状态。 |
| retain | boolean | 是 | - | 是否允许将地理位置权限状态保存到系统中。可通过[GeolocationPermissions](#geolocationpermissions9)接口管理保存到系统的地理位置权限。 |
......@@ -3736,7 +3736,7 @@ createWebMessagePorts(): Array\<WebMessagePort\>
| 类型 | 说明 |
| ------------------------------- | ------------- |
| ---------------------------------------- | ---------- |
| Array\<[WebMessagePort](#webmessageport9)\> | web消息端口列表。 |
**示例:**
......@@ -3770,8 +3770,8 @@ postMessage(options: { message: WebMessageEvent, uri: string}): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---------- | --------------- | ---- | ---- | ------------------------- |
| message | [WebMessageEvent](#webmessageevent9) | 是 | - |要发送的消息,包含数据和消息端口。 |
| ------- | ------------------------------------ | ---- | ---- | ----------------- |
| message | [WebMessageEvent](#webmessageevent9) | 是 | - | 要发送的消息,包含数据和消息端口。 |
| uri | string | 是 | - | 接收该消息的URI。 |
**示例:**
......@@ -3881,7 +3881,7 @@ getUrl(): string
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------- |
| ------ | ----------- |
| string | 当前页面的url地址。 |
**示例:**
......@@ -3913,7 +3913,7 @@ searchAllAsync(searchString: string): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---- | ------ | ---- | ---- | --------------------- |
| ------------ | ------ | ---- | ---- | ------- |
| searchString | string | 是 | - | 查找的关键字。 |
**示例:**
......@@ -3986,7 +3986,7 @@ searchNext(forward: boolean): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---- | ------ | ---- | ---- | --------------------- |
| ------- | ------- | ---- | ---- | ----------- |
| forward | boolean | 是 | - | 从前向后或者逆向查找。 |
......@@ -4122,13 +4122,13 @@ getCookie(url: string): string
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ---- | ------ | ---- | ---- | ----------------- |
| url | string | 是 | - | 要获取的cookie所属的url。 |
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------ | ----------------- |
| string | 指定url对应的cookie的值。 |
**示例:**
......@@ -4169,7 +4169,7 @@ setCookie(url: string, value: string): boolean
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------- | ------------- |
| boolean | 设置cookie是否成功。 |
**示例:**
......@@ -4237,7 +4237,7 @@ saveCookieAsync(): Promise\<boolean>
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ----------------- | --------------------------- |
| Promise\<boolean> | Promise实例,用于获取cookie是否成功保存。 |
**示例:**
......@@ -4276,7 +4276,7 @@ saveCookieAsync(callback: AsyncCallback\<boolean>): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| -------- | ----------------------- | ---- | ---- | ---------------------------- |
| callback | AsyncCallback\<boolean> | 是 | - | 返回cookie是否成功保存的布尔值作为回调函数的入参。 |
**示例:**
......@@ -4311,7 +4311,7 @@ isCookieAllowed(): boolean
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------- | ------------------- |
| boolean | 是否拥有发送和接收cookie的权限。 |
**示例:**
......@@ -4345,7 +4345,7 @@ putAcceptCookieEnabled(accept: boolean): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ------ | ------- | ---- | ---- | --------------------- |
| accept | boolean | 是 | - | 设置是否拥有发送和接收cookie的权限。 |
**示例:**
......@@ -4378,7 +4378,7 @@ isThirdCookieAllowed(): boolean
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------- | ---------------------- |
| boolean | 是否拥有发送和接收第三方cookie的权限。 |
**示例:**
......@@ -4412,7 +4412,7 @@ putAcceptThirdPartyCookieEnabled(accept: boolean): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ------ | ------- | ---- | ---- | ------------------------ |
| accept | boolean | 是 | - | 设置是否拥有发送和接收第三方cookie的权限。 |
**示例:**
......@@ -4445,7 +4445,7 @@ existCookie(): boolean
**返回值:**
| 类型 | 说明 |
| ------- | -------------------- |
| ------- | ----------- |
| boolean | 是否存在cookie。 |
**示例:**
......@@ -4689,7 +4689,7 @@ static allowGeolocation(origin: string): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| ------ | ------ | ---- | ---- | ---------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
**示例:**
......@@ -4723,7 +4723,7 @@ static deleteGeolocation(origin: string): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| ------ | ------ | ---- | ---- | ---------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
**示例:**
......@@ -4784,7 +4784,7 @@ static getAccessibleGeolocation(origin: string, callback: AsyncCallback\<boolean
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| -------- | ------------------------ | ---- | ---- | ---------------------------------------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
| callback | AsyncCallback\<boolean\> | 是 | - | 返回指定源的地理位置权限状态。获取成功,true表示已授权,false表示拒绝访问。获取失败,表示不存在指定源的权限状态。 |
......@@ -4825,13 +4825,13 @@ static getAccessibleGeolocation(origin: string): Promise\<boolean\>
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| ------ | ------ | ---- | ---- | ---------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
**返回值:**
| 类型 | 说明 |
| ------------------ | ------------------------------------ |
| ------------------ | ---------------------------------------- |
| Promise\<boolean\> | Promise实例,用于获取指定源的权限状态,获取成功,true表示已授权,false表示拒绝访问。获取失败,表示不存在指定源的权限状态。 |
**示例:**
......@@ -4869,7 +4869,7 @@ static getStoredGeolocation(callback: AsyncCallback\<Array\<string\>\>): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| -------- | -------------------------------- | ---- | ---- | -------------------- |
| callback | AsyncCallback\<Array\<string\>\> | 是 | - | 返回已存储地理位置权限状态的所有源信息。 |
**示例:**
......@@ -4909,13 +4909,13 @@ static getStoredGeolocation(): Promise\<Array\<string\>\>
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ----- | ------------- |
| -------- | -------------------------------- | ---- | ---- | -------------------- |
| callback | AsyncCallback\<Array\<string\>\> | 是 | - | 返回已存储地理位置权限状态的所有源信息。 |
**返回值:**
| 类型 | 说明 |
| -------------------------- | ------------------------------------ |
| -------------------------- | -------------------------------- |
| Promise\<Array\<string\>\> | Promise实例,用于获取已存储地理位置权限状态的所有源信息。 |
**示例:**
......@@ -5337,7 +5337,7 @@ onRenderExited接口返回的渲染进程退出的具体原因。
| HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 |
| Img | HTML::img标签。 |
| Map | 地理地址。 |
| Phone | 手机电话号码。 |
| Phone | 电话号码。 |
| Unknown | 未知内容。 |
## SslError<sup>9+</sup>枚举说明
......@@ -5345,7 +5345,7 @@ onRenderExited接口返回的渲染进程退出的具体原因。
onSslErrorEventReceive接口返回的SSL错误的具体原因。
| 名称 | 描述 |
| -------------- | ----------------- |
| ------------ | ----------- |
| Invalid | 一般错误。 |
| HostMismatch | 主机名不匹配。 |
| DateInvalid | 证书日期无效。 |
......@@ -5354,8 +5354,8 @@ onSslErrorEventReceive接口返回的SSL错误的具体原因。
## ProtectedResourceType<sup>9+</sup>枚举说明
| 名称 | 描述 | 备注 |
| --------- | -------------- | -------------- |
| MidiSysex | MIDI SYSEX资源。| 目前仅支持权限事件上报,MIDI设备的使用还未支持。|
| --------- | ------------- | -------------------------- |
| MidiSysex | MIDI SYSEX资源。 | 目前仅支持权限事件上报,MIDI设备的使用还未支持。 |
## WebAsyncController
......@@ -5424,7 +5424,7 @@ storeWebArchive(baseName: string, autoName: boolean): Promise<string>
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------------------------------- |
| --------------- | -------------------------------- |
| Promise<string> | Promise实例,保存成功返回文件路径,保存失败返回null。 |
**示例:**
......@@ -5471,7 +5471,7 @@ postMessageEvent(message: WebMessageEvent): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ------- | ------------------------------------ | ---- | ---- | ------- |
| message | [WebMessageEvent](#webmessageevent9) | 是 | - | 要发送的消息。 |
**示例:**
......@@ -5506,7 +5506,7 @@ onMessageEvent(callback: (result: string) => void): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| -------- | -------- | ---- | ---- | ---------- |
| callback | function | 是 | - | 接收消息的回调函数。 |
**示例:**
......@@ -5546,7 +5546,7 @@ getData(): string
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------- |
| ------ | -------------- |
| string | 当前该类型对象中存放的消息。 |
**示例:**
......@@ -5578,7 +5578,7 @@ setData(data: string): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ---- | ------ | ---- | ---- | ------- |
| data | string | 是 | - | 要发送的消息。 |
**示例:**
......@@ -5612,7 +5612,7 @@ getPorts(): Array\<WebMessagePort\>
**返回值:**
| 类型 | 说明 |
| ------------------------------- | ------------- |
| ---------------------------------------- | ---------------- |
| Array\<[WebMessagePort](#webmessageport9)\> | 当前该类型对象中存放的消息端口。 |
**示例:**
......@@ -5646,7 +5646,7 @@ setPorts(ports: Array\<WebMessagePort\>): void
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ----------------- |
| ----- | ---------------------------------------- | ---- | ---- | --------- |
| ports | Array\<[WebMessagePort](#webmessageport9)\> | 是 | - | 要发送的消息端口。 |
**示例:**
......
......@@ -14,7 +14,7 @@ ImageData对象可以存储canvas渲染的像素数据。
| -------- | -------- | -------- |
| width | number | 矩形区域实际像素宽度。 |
| height | number | 矩形区域实际像素高度。 |
| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。 |
| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。</br> **说明:** 需要注意的是,width和height是vp单位表示的,而data是以px为单位的二维数组转换得到的一维数组,因此需要使用vp2px接口得到原二维data数组的实际width和height。 |
**示例:**
......
......@@ -34,7 +34,7 @@ List(value?:{space?: number&nbsp;|&nbsp;string, initialIndex?: number, scroller?
| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。<br/>默认值:Axis.Vertical |
| divider | {<br/>strokeWidth:&nbsp;[Length](ts-types.md#length),<br/>color?:[ResourceColor](ts-types.md),<br/>startMargin?:&nbsp;Length,<br/>endMargin?:&nbsp;Length<br/>}&nbsp;\|&nbsp;null | 设置ListItem分割线样式,默认无分割线。<br/>- strokeWidth:&nbsp;分割线的线宽。<br/>- color:&nbsp;分割线的颜色。<br/>- startMargin:&nbsp;分割线与列表侧边起始端的距离。<br/>- endMargin:&nbsp;分割线与列表侧边结束端的距离。 |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Off |
| cachedCount | number | 设置预加载的ListItem数量。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)<br/>默认值:1 |
| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)<br/>默认值:1 |
| editMode | boolean | 声明当前List组件是否处于可编辑模式。<br/>默认值:false |
| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果。<br/>默认值:EdgeEffect.Spring |
| chainAnimation | boolean | 设置当前List是否启用链式联动动效,开启后列表滑动以及顶部和底部拖拽时会有链式联动的效果。链式联动效果:List内的list-item间隔一定距离,在基本的滑动交互行为下,主动对象驱动从动对象进行联动,驱动效果遵循弹簧物理动效。<br/>默认值:false<br/>-&nbsp;false:不启用链式联动。<br/>-&nbsp;true:启用链式联动。 |
......@@ -70,8 +70,8 @@ List(value?:{space?: number&nbsp;|&nbsp;string, initialIndex?: number, scroller?
| onScrollIndex(event: (start: number, end: number) => void) | 列表滑动时触发。<br/>计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。<br/>- start: 滑动起始位置索引值。<br/>- end: 滑动结束位置索引值。 |
| onReachStart(event: () => void) | 列表到达起始位置时触发。 |
| onReachEnd(event: () => void) | 列表到底末尾位置时触发。 |
| onScrollBegin<sup>9+</sup>(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | 列表开始滑动时触发<br/>\- dx:即将发生的水平方向滚动量。<br/>\- dy:即将发生的竖直方向滚动量。<br/>- dxRemain:水平方向滚动剩余量。<br/>\- dyRemain:竖直方向滚动剩余量。 |
| onScrollStop(event: () => void) | 列表滑动停止时触发。 |
| onScrollBegin<sup>9+</sup>(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | 列表开始滑动时触发,事件参数传入即将发生的滑动量,事件处理函数中可根据应用场景计算实际需要的滑动量并作为事件处理函数的返回值返回,列表将按照返回值的实际滑动量进行滑动。<br/>\- dx:即将发生的水平方向滑动量。<br/>\- dy:即将发生的竖直方向滑动量。<br/>- dxRemain:水平方向实际滑动量。<br/>\- dyRemain:竖直方向实际滑动量。 |
| onScrollStop(event: () => void) | 列表滑动停止时触发。手拖动列表或列表的滚动条触发的滑动,手离开屏幕并且滑动停止时会触发该事件;使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的滑动,不会触发该事件。 |
| onItemMove(event: (from: number, to: number) => boolean) | 列表元素发生移动时触发。<br/>- from: 移动前索引值。<br/>- to: 移动后索引值。 |
| onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) \| void) | 开始拖拽列表元素时触发。<br/>- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)<br/>- itemIndex: 被拖拽列表元素索引值。 |
| onItemDragEnter(event: (event: ItemDragInfo) => void) | 拖拽进入列表元素范围内时触发。<br/>- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。 |
......@@ -84,8 +84,8 @@ List(value?:{space?: number&nbsp;|&nbsp;string, initialIndex?: number, scroller?
| 名称 | 描述 |
| ------ | ------------------------- |
| Idle | 未滑动状态。 |
| Scroll | 惯性滑动状态。 |
| Fling | 手指拖动状态。 |
| Scroll | 手指拖动状态。 |
| Fling | 惯性滑动状态。 |
> **说明:**
>
......
......@@ -4,7 +4,7 @@
| 名称 | 描述 |
| ---- | ------------------------------------------------------------ |
| ---- | ---------------------------------------- |
| px | 屏幕物理像素单位。 |
| vp | 屏幕密度相关像素,根据屏幕像素密度转换为屏幕物理像素,当数值不带单位时,默认单位vp。 |
| fp | 字体像素,与vp类似适用屏幕密度变化,随系统字体大小设置变化。 |
......@@ -72,10 +72,3 @@ struct Example {
```
![zh-cn_image_0000001169582302](figures/zh-cn_image_0000001169582302.png)
## 相关实例
基于像素转换,有以下相关实例可供参考:
- [像素转换(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/PixelUnitsDemo)
......@@ -32,6 +32,7 @@
- 安全
- [AccessToken错误码](errorcode-access-token.md)
- [HUKS错误码](errorcode-huks.md)
- [用户认证错误码](errorcode-useriam.md)
- 数据管理
- [关系型数据库错误码](errorcode-data-rdb.md)
- [数据共享错误码](errorcode-datashare.md)
......
......@@ -563,15 +563,15 @@ function encryptMessageCallback() {
|Sign|init(priKey : PriKey) : Promise\<void>|使用Promise方式设置密钥并初始化Sign对象|
|Sign|update(data : DataBlob, callback : AsyncCallback\<void>) : void|使用callback方式添加签名数据|
|Sign|update(data : DataBlob) : Promise\<void>|用Promise方式添加签名数据|
|Sign|sign(data : DataBlob, callback : AsyncCallback<DataBlob>) : void|使用callback方式签名所有数据|
|Sign|sign(data : DataBlob) : Promise<DataBlob>|使用Promise方式签名所有数据|
|Sign|sign(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void|使用callback方式签名所有数据|
|Sign|sign(data : DataBlob) : Promise\<DataBlob>|使用Promise方式签名所有数据|
|cryptoFramework|function createVerify(algName : string) : Verify|根据String设置的参数创建Verify对象|
|Verify|init(priKey : PriKey, callback : AsyncCallback\<void>) : void|使用callback方式设置密钥并初始化Verify对象|
|Verify|init(priKey : PriKey) : Promise\<void>|使用Promise方式设置密钥并初始化Verify对象|
|Verify|update(data : DataBlob, callback : AsyncCallback\<void>) : void|使用callback方式添加验签数据|
|Verify|update(data : DataBlob) : Promise\<void>|用Promise方式添加验签数据|
|Verify|verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback<boolean>) : void|使用callback方式验签所有数据|
|Verify|verify(data : DataBlob, signatureData : DataBlob) : Promise<boolean>|使用Promise方式验签所有数据|
|Verify|verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback\<boolean>) : void|使用callback方式验签所有数据|
|Verify|verify(data : DataBlob, signatureData : DataBlob) : Promise\<boolean>|使用Promise方式验签所有数据|
**开发步骤**
......@@ -761,10 +761,10 @@ function verifyMessageCallback() {
| 实例名 | 接口名 | 描述 |
| --------------- | ------------------------------------------------------------ | -------------------------------------------------- |
| cryptoFramework | function createMd(algName : string) : Md; | 指定摘要算法,生成摘要操作实例Md |
| Md | update(input : DataBlob, callback : AsyncCallback\<void\>) : void; | 接受用户输入数据,通过Callback的方式,异步更新摘要 |
| Md | update(input : DataBlob) : Promise\<void\>; | 接受用户输入数据,通过Promise的方式,异步更新摘要 |
| Md | digest(callback : AsyncCallback\<DataBlob\>) : void; | 通过Callback的方式,返回结果 |
| Md | digest() : Promise\<DataBlob\>; | 通过Promise的方式,返回结果 |
| Md | update(input : DataBlob, callback : AsyncCallback\<void>) : void; | 接受用户输入数据,通过Callback的方式,异步更新摘要 |
| Md | update(input : DataBlob) : Promise\<void>; | 接受用户输入数据,通过Promise的方式,异步更新摘要 |
| Md | digest(callback : AsyncCallback\<DataBlob>) : void; | 通过Callback的方式,返回结果 |
| Md | digest() : Promise\<DataBlob>; | 通过Promise的方式,返回结果 |
| Md | getMdLength() : number; | 获取摘要的长度(由指定的摘要算法决定) |
| Md | readonly algName : string; | 获取当前设置的摘要算法名 |
......@@ -923,12 +923,12 @@ Mac(message authentication code)可以对消息进行完整性校验,通过使
| 实例名 | 接口名 | 描述 |
| --------------- | ------------------------------------------------------------ | --------------------------------------------------- |
| cryptoFramework | function createMac(algName : string) : Mac; | 指定摘要算法,生成消息认证码实例Mac |
| Mac | init(key : SymKey, callback : AsyncCallback\<void\>) : void; | 接收输入对称密钥,通过Callback的方式,异步初始化MAC |
| Mac | init(key : SymKey) : Promise\<void\>; | 接收输入对称密钥,通过Promise的方式,异步初始化MAC |
| Mac | update(input : DataBlob, callback : AsyncCallback\<void\>) : void; | 接受输入数据,通过Callback的方式,异步更新MAC |
| Mac | update(input : DataBlob) : Promise\<void\>; | 接受输入数据,通过Promise的方式,异步更新MAC |
| Mac | doFinal(callback : AsyncCallback\<DataBlob\>) : void; | 通过Callback的方式,返回MAC计算结果 |
| Mac | doFinal() : Promise\<DataBlob\>; | 通过Promise的方式,返回MAC计算结果 |
| Mac | init(key : SymKey, callback : AsyncCallback\<void>) : void; | 接收输入对称密钥,通过Callback的方式,异步初始化MAC |
| Mac | init(key : SymKey) : Promise\<void>; | 接收输入对称密钥,通过Promise的方式,异步初始化MAC |
| Mac | update(input : DataBlob, callback : AsyncCallback\<void>) : void; | 接受输入数据,通过Callback的方式,异步更新MAC |
| Mac | update(input : DataBlob) : Promise\<void>; | 接受输入数据,通过Promise的方式,异步更新MAC |
| Mac | doFinal(callback : AsyncCallback\<DataBlob>) : void; | 通过Callback的方式,返回MAC计算结果 |
| Mac | doFinal() : Promise\<DataBlob>; | 通过Promise的方式,返回MAC计算结果 |
| Mac | getMacLength() : number; | 获取MAC的长度(由指定的摘要算法决定) |
| Mac | readonly algName : string; | 获取当前设置的摘要算法名 |
......@@ -1055,10 +1055,10 @@ function doHmacByCallback(algName) {
| 实例名 | 接口名 | 描述 |
| --------------- | ------------------------------------------------------------ | ---------------------------------------------- |
| cryptoFramework | function createRandom() : Random; | 生成随机数Random实例 |
| Random | generateRandom(len : number, callback: AsyncCallback\<DataBlob\>) : void; | 接受输入长度,通过Callback,异步生成随机数 |
| Random | generateRandom(len : number) : Promise\<DataBlob\>; | 接受输入长度,通过Promise,异步生成随机数 |
| Random | setSeed(seed : DataBlob, callback : AsyncCallback\<void\>) : void; | 接受输入Blob,通过Callback的方式,异步设置种子 |
| Random | setSeed(seed : DataBlob) : Promise\<void\>; | 接受输入Blob,通过Promise的方式,异步设置种子 |
| Random | generateRandom(len : number, callback: AsyncCallback\<DataBlob>) : void; | 接受输入长度,通过Callback,异步生成随机数 |
| Random | generateRandom(len : number) : Promise\<DataBlob>; | 接受输入长度,通过Promise,异步生成随机数 |
| Random | setSeed(seed : DataBlob, callback : AsyncCallback\<void>) : void; | 接受输入Blob,通过Callback的方式,异步设置种子 |
| Random | setSeed(seed : DataBlob) : Promise\<void>; | 接受输入Blob,通过Promise的方式,异步设置种子 |
**开发步骤**
......@@ -1135,16 +1135,16 @@ function doRandByCallback(len) {
| 实例名 | 接口名 | 描述 |
| --------------- | ------------------------------------------------------------ | -------------------------------------------- |
| cryptoFramework | createX509Cert(inStream : EncodingBlob, callback : AsyncCallback<X509Cert>) : void | 使用callback方式解析X509证书数据生成证书对象 |
| cryptoFramework | createX509Cert(inStream : EncodingBlob) : Promise<X509Cert> | 使用promise方式解析X509证书数据生成证书对象 |
| X509Cert | verify(key : PubKey, callback : AsyncCallback<void>) : void | 使用callback方式进行证书验签 |
| X509Cert | verify(key : PubKey) : Promise<void> | 使用promise方式进行证书验签 |
| X509Cert | getEncoded(callback : AsyncCallback<EncodingBlob>) : void | 使用callback方式获取证书序列化数据 |
| X509Cert | getEncoded() : Promise<EncodingBlob> | 使用promise方式获取证书序列化数据 |
| X509Cert | getPublicKey(callback : AsyncCallback<PubKey>) : void | 使用callback方式获取证书公钥 |
| X509Cert | getPublicKey() : Promise<PubKey> | 使用Promise方式获取证书公钥 |
| X509Cert | checkValidityWithDate(date: string, callback : AsyncCallback<void>) : void | 使用callback方式校验证书有效期 |
| X509Cert | checkValidityWithDate(date: string) : Promise<void> | 使用Promise方式校验证书有效期 |
| cryptoFramework | createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\<X509Cert>) : void | 使用callback方式解析X509证书数据生成证书对象 |
| cryptoFramework | createX509Cert(inStream : EncodingBlob) : Promise\<X509Cert> | 使用promise方式解析X509证书数据生成证书对象 |
| X509Cert | verify(key : PubKey, callback : AsyncCallback\<void>) : void | 使用callback方式进行证书验签 |
| X509Cert | verify(key : PubKey) : Promise\<void> | 使用promise方式进行证书验签 |
| X509Cert | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void | 使用callback方式获取证书序列化数据 |
| X509Cert | getEncoded() : Promise\<EncodingBlob> | 使用promise方式获取证书序列化数据 |
| X509Cert | getPublicKey(callback : AsyncCallback\<PubKey>) : void | 使用callback方式获取证书公钥 |
| X509Cert | getPublicKey() : Promise\<PubKey> | 使用Promise方式获取证书公钥 |
| X509Cert | checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void | 使用callback方式校验证书有效期 |
| X509Cert | checkValidityWithDate(date: string) : Promise\<void> | 使用Promise方式校验证书有效期 |
| X509Cert | getVersion() : number | 获取证书版本 |
| X509Cert | getSerialNumber() : number | 获取证书序列号 |
| X509Cert | getIssuerName() : DataBlob | 获取证书颁发者名称 |
......@@ -1287,27 +1287,27 @@ function certSample() {
| 实例名 | 接口名 | 描述 |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| cryptoFramework | createX509Crl(inStream : EncodingBlob, callback : AsyncCallback<X509Crl>) : void | 使用callback方式解析X509证书吊销列表数据生成证书吊销列表对象 |
| cryptoFramework | createX509Crl(inStream : EncodingBlob) : Promise<X509Crl> | 使用promise方式解析X509证书吊销列表数据生成证书吊销列表对象 |
| X509Crl | isRevoked(cert : X509Cert, callback : AsyncCallback<boolean>) : void | 使用callback方式检查证书是否被吊销 |
| X509Crl | isRevoked(cert : X509Cert) : Promise<boolean> | 使用promise方式检查证书是否被吊销 |
| cryptoFramework | createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\<X509Crl>) : void | 使用callback方式解析X509证书吊销列表数据生成证书吊销列表对象 |
| cryptoFramework | createX509Crl(inStream : EncodingBlob) : Promise\<X509Crl> | 使用promise方式解析X509证书吊销列表数据生成证书吊销列表对象 |
| X509Crl | isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void | 使用callback方式检查证书是否被吊销 |
| X509Crl | isRevoked(cert : X509Cert) : Promise\<boolean> | 使用promise方式检查证书是否被吊销 |
| X509Crl | getType() : string | 获取证书吊销列表类型 |
| X509Crl | getEncoded(callback : AsyncCallback<EncodingBlob>) : void | 使用callback方式获取证书吊销列表序列化数据 |
| X509Crl | getEncoded() : Promise<EncodingBlob> | 使用promise方式获取证书吊销列表序列化数据 |
| X509Crl | verify(key : PubKey, callback : AsyncCallback<void>) : void | 使用callback方式进行证书吊销列表验签 |
| X509Crl | verify(key : PubKey) : Promise<void> | 使用Promise方式进行证书吊销列表验签 |
| X509Crl | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void | 使用callback方式获取证书吊销列表序列化数据 |
| X509Crl | getEncoded() : Promise\<EncodingBlob> | 使用promise方式获取证书吊销列表序列化数据 |
| X509Crl | verify(key : PubKey, callback : AsyncCallback\<void>) : void | 使用callback方式进行证书吊销列表验签 |
| X509Crl | verify(key : PubKey) : Promise\<void> | 使用Promise方式进行证书吊销列表验签 |
| X509Crl | getVersion() : number | 获取证书吊销列表版本 |
| X509Crl | getIssuerName() : DataBlob | 获取证书吊销列表颁发者名称 |
| X509Crl | getLastUpdate() : string | 获取证书吊销列表lastUpdate日期 |
| X509Crl | getNextUpdate() : string | 获取证书吊销列表nextUpdate日期 |
| X509Crl | getRevokedCert(serialNumber : number, callback : AsyncCallback<X509CrlEntry>) : void | 使用callback方式通过序列号获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCert(serialNumber : number) : Promise<X509CrlEntry> | 使用Promise方式通过序列号获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback<X509CrlEntry>) : void | 使用callback方式通过X509证书获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCertWithCert(cert : X509Cert) : Promise<X509CrlEntry> | 使用Promise方式通过X509证书获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCerts(callback : AsyncCallback<Array<X509CrlEntry>>) : void | 使用callback方式获取证书吊销列表的所有被吊销证书 |
| X509Crl | getRevokedCerts() : Promise<Array<X509CrlEntry>> | 使用Promise方式获取证书吊销列表的所有被吊销证书 |
| X509Crl | getTbsInfo(callback : AsyncCallback<DataBlob>) : void | 使用callback方式获取证书吊销列表的tbsCertList |
| X509Crl | getTbsInfo() : Promise<DataBlob> | 使用Promise方式获取证书吊销列表的tbsCertList |
| X509Crl | getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) : void | 使用callback方式通过序列号获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCert(serialNumber : number) : Promise\<X509CrlEntry> | 使用Promise方式通过序列号获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>) : void | 使用callback方式通过X509证书获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCertWithCert(cert : X509Cert) : Promise\<X509CrlEntry> | 使用Promise方式通过X509证书获取证书吊销列表中的被吊销证书 |
| X509Crl | getRevokedCerts(callback : AsyncCallback\<Array\<X509CrlEntry>>) : void | 使用callback方式获取证书吊销列表的所有被吊销证书 |
| X509Crl | getRevokedCerts() : Promise\<Array\<X509CrlEntry>> | 使用Promise方式获取证书吊销列表的所有被吊销证书 |
| X509Crl | getTbsInfo(callback : AsyncCallback\<DataBlob>) : void | 使用callback方式获取证书吊销列表的tbsCertList |
| X509Crl | getTbsInfo() : Promise\<DataBlob> | 使用Promise方式获取证书吊销列表的tbsCertList |
| X509Crl | getSignature() : DataBlob | 获取证书吊销列表的签名 |
| X509Crl | getSignatureAlgName() : string | 获取证书吊销列表的签名算法名称 |
| X509Crl | getSignatureAlgOid() : string | 获取证书吊销列表的签名算法OID |
......@@ -1437,8 +1437,8 @@ function crlSample() {
| 实例名 | 接口名 | 描述 |
| ------------------ | ------------------------------------------------------------ | -------------------------------- |
| cryptoFramework | createCertChainValidator(algorithm :string) : CertChainValidator | 使用指定算法生成证书链校验器对象 |
| CertChainValidator | validate(certChain : CertChainData, callback : AsyncCallback<void>) : void | 使用callback方式校验证书链 |
| CertChainValidator | validate(certChain : CertChainData) : Promise<void> | 使用promise方式校验证书链 |
| CertChainValidator | validate(certChain : CertChainData, callback : AsyncCallback\<void>) : void | 使用callback方式校验证书链 |
| CertChainValidator | validate(certChain : CertChainData) : Promise\<void> | 使用promise方式校验证书链 |
| CertChainValidator | algorithm : string | 证书链校验器算法名称 |
**开发步骤**
......@@ -1548,13 +1548,13 @@ function certChainValidatorSample() {
| 实例名 | 接口名 | 描述 |
| ------------ | ----------------------------------------------------------- | ------------------------------------------ |
| X509CrlEntry | getEncoded(callback : AsyncCallback<EncodingBlob>) : void; | 使用callback方式获取被吊销证书的序列化数据 |
| X509CrlEntry | getEncoded() : Promise<EncodingBlob>; | 使用promise方式获取被吊销证书的序列化数据 |
| X509CrlEntry | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void; | 使用callback方式获取被吊销证书的序列化数据 |
| X509CrlEntry | getEncoded() : Promise\<EncodingBlob>; | 使用promise方式获取被吊销证书的序列化数据 |
| X509CrlEntry | getSerialNumber() : number; | 获取被吊销证书的序列号 |
| X509CrlEntry | getCertIssuer(callback : AsyncCallback<DataBlob>) : void; | 使用callback方式获取被吊销证书颁发者 |
| X509CrlEntry | getCertIssuer() : Promise<DataBlob>; | 使用promise方式获取被吊销证书颁发者 |
| X509CrlEntry | getRevocationDate(callback : AsyncCallback<string>) : void; | 使用callback方式获取被吊销证书的吊销日期 |
| X509CrlEntry | getRevocationDate() : Promise<string>; | 使用promise方式获取被吊销证书的吊销日期 |
| X509CrlEntry | getCertIssuer(callback : AsyncCallback\<DataBlob>) : void; | 使用callback方式获取被吊销证书颁发者 |
| X509CrlEntry | getCertIssuer() : Promise\<DataBlob>; | 使用promise方式获取被吊销证书颁发者 |
| X509CrlEntry | getRevocationDate(callback : AsyncCallback\<string>) : void; | 使用callback方式获取被吊销证书的吊销日期 |
| X509CrlEntry | getRevocationDate() : Promise\<string>; | 使用promise方式获取被吊销证书的吊销日期 |
**开发步骤**
......@@ -1606,4 +1606,3 @@ function crlEntrySample() {
});
}
```
......@@ -3,9 +3,9 @@
## 开发说明
| 任务 | 简介 | 相关资源 |
| ---------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ----------- | ---------------------------------------- | ---------------------------------------- |
| 准备开发环境 | 了解声明式UI的工程结构。<br>了解资源分类与访问。 | [OpenHarmony工程介绍](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-project-overview-0000001218440650)<br>[资源分类与访问](../quick-start/resource-categories-and-access.md) |
| 学习ArkTS语言 | ArkTS是HarmonyOS优选的主力应用开发语言,当前,ArkTS在TS基础上主要扩展了声明式UI能力。 | [学习ArkTS语言](../quick-start/arkts-get-started.md) |
| 学习ArkTS语言 | ArkTS是OpenHarmony优选的主力应用开发语言,当前,ArkTS在TS基础上主要扩展了声明式UI能力。 | [学习ArkTS语言](../quick-start/arkts-get-started.md) |
| 开发页面 | 根据页面的使用场景,选择合适的布局。<br>根据页面需要实现的内容,添加系统内置组件,并修改组件样式。<br>更新页面内容,丰富页面展现形式。 | [创建页面](#创建页面)<br> &nbsp;&nbsp;[常见布局开发指导](ui-ts-layout-linear.md)<br> &nbsp;&nbsp;[常见组件说明](ui-ts-components-intro.md)<br>[修改组件样式](#修改组件样式)<br>[更新页面内容](#更新页面内容) |
| (可选)页面多样化 | 绘图和动画。 | [绘图组件](../reference/arkui-ts/ts-drawing-components-circle.md)<br>[画布组件](../reference/arkui-ts/ts-components-canvas-canvas.md)<br>[动画](../reference/arkui-ts/ts-animatorproperty.md) |
| (可选)页面之间的跳转 | 使用页面路由实现多个页面之前的跳转。 | [页面路由](../reference/apis/js-apis-router.md) |
......
......@@ -5,10 +5,12 @@
- 容器: [Flex组件](../reference/arkui-ts/ts-container-flex.md)作为Flex布局的容器,用于设置布局相关属性。
- 子组件: Flex组件内的子组件自动成为布局的子组件。
- 主轴: 水平方向的轴线,子组件默认沿着主轴排列。主轴开始的位置称为主轴起始端,结束位置称为主轴终点端。
- 交叉轴: 垂直方向的轴线。交叉始的位置称为主轴首部,结束位置称为交叉轴尾部。
- 主轴: Flex组件布局方向的轴线,子组件默认沿着主轴排列。主轴开始的位置称为主轴起始端,结束位置称为主轴终点端。
- 交叉轴: 垂直于主轴方向的轴线。交叉轴起始的位置称为主轴首部,结束位置称为交叉轴尾部。
![](figures/flex.png)
以FlexDirection.Row的Flex为例:
![](figures/flex.png)
## 容器组件属性
......
......@@ -8,10 +8,10 @@
- [使用ArkTS语言开发(FA模型)](quick-start/start-with-ets-fa.md)
- [使用JS语言开发(FA模型)](quick-start/start-with-js-fa.md)
- 开发基础知识
- [应用包结构说明(FA模型)](quick-start/package-structure.md)
- [应用包结构说明(Stage模型)](quick-start/stage-structure.md)
- [应用包结构配置文件的说明(FA模型)](quick-start/package-structure.md)
- [应用包结构配置文件的说明(Stage模型)](quick-start/stage-structure.md)
- [SysCap说明](quick-start/syscap.md)
- [HarmonyAppProvision配置文件](quick-start/app-provision-structure.md)
- [资源分类与访问](quick-start/resource-categories-and-access.md)
- 学习ArkTS语言
- [初识ArkTS语言](quick-start/arkts-get-started.md)
- ArkTS语法(声明式UI)
......@@ -49,35 +49,30 @@
- [方舟开发框架(ArkUI)概述](ui/arkui-overview.md)
- 基于ArkTS的声明式开发范式
- [概述](ui/ui-ts-overview.md)
- 框架说明
- 文件组织
- [目录结构](ui/ts-framework-directory.md)
- [应用代码文件访问规则](ui/ts-framework-file-access-rules.md)
- 资源管理
- [资源文件的分类](ui/ui-ts-basic-resource-file-categories.md)
- [资源访问](ui/ts-resource-access.md)
- [像素单位](ui/ts-pixel-units.md)
- 深入理解组件化
- [自定义组件初始化](ui/ts-custom-component-initialization.md)
- [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md)
- [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md)
- 常见组件开发指导
- [Button开发指导](ui/ui-ts-basic-components-button.md)
- [Web开发指导](ui/ui-ts-components-web.md)
- 常见布局开发指导
- [弹性布局](ui/ui-ts-layout-flex.md)
- [栅格布局](ui/ui-ts-layout-grid-container.md)
- [媒体查询](ui/ui-ts-layout-mediaquery.md)
- 体验声明式UI
- [创建声明式UI工程](ui/ui-ts-creating-project.md)
- [初识Component](ui/ui-ts-components.md)
- [声明式UI开发指导](ui/ui-ts-developing-intro.md)
- 声明式UI开发实例
- [创建简单视图](ui/ui-ts-creating-simple-page.md)
- 页面布局与连接
- 构建完整实例
- [构建食物数据模型](ui/ui-ts-building-data-model.md)
- [构建食物列表List布局](ui/ui-ts-building-category-list-layout.md)
- [构建食物分类Grid布局](ui/ui-ts-building-category-grid-layout.md)
- [页面跳转与数据传递](ui/ui-ts-page-redirection-data-transmission.md)
- [性能提升的推荐方法](ui/ts-performance-improvement-recommendation.md)
- 添加闪屏动画
- [绘制图像](ui/ui-ts-drawing-feature.md)
- [添加动画效果](ui/ui-ts-animation-feature.md)
- [常用组件说明](ui/ui-ts-components-intro.md)
- 常见布局开发指导
- 自适应布局
- [线性布局](ui/ui-ts-layout-linear.md)
- [层叠布局](ui/ui-ts-layout-stack.md)
- [弹性布局](ui/ui-ts-layout-flex.md)
- [网格布局](ui/ui-ts-layout-grid.md)
- 响应式布局
- [栅格布局](ui/ui-ts-layout-grid-container-new.md)
- [媒体查询](ui/ui-ts-layout-mediaquery.md)
- [自定义组件的生命周期](ui/ui-ts-custom-component-lifecycle-callbacks.md)
- [Web组件开发指导](ui/ui-ts-components-web.md)
- [性能提升的推荐方法](ui/ui-ts-performance-improvement-recommendation.md)
- 兼容JS的类Web开发范式
- [概述](ui/ui-js-overview.md)
- 框架说明
......@@ -174,9 +169,14 @@
- [OpenSL ES播放开发指导](media/opensles-playback.md)
- [OpenSL ES录音开发指导](media/opensles-capture.md)
- [音频焦点模式开发指导](media/audio-interruptmode.md)
- [音量管理开发指导](media/audio-volume-manager.md)
- [路由、设备管理开发指导](media/audio-routing-manager.md)
- 视频
- [视频播放开发指导](media/video-playback.md)
- [视频录制开发指导](media/video-recorder.md)
- 媒体会话
- [AVSession开发概述](media/avsession-overview.md)
- [AVSession开发指导](media/avsession-guidelines.md)
- 图片
- [图片开发指导](media/image.md)
- 相机
......@@ -200,6 +200,7 @@
- Hap包签名工具
- [Hap包签名工具概述](security/hapsigntool-overview.md)
- [Hap包签名工具指导](security/hapsigntool-guidelines.md)
- [HarmonyAppProvision配置文件](security/app-provision-structure.md)
- 网络与连接
- 网络管理
- [网络管理开发概述](connectivity/net-mgmt-overview.md)
......@@ -230,6 +231,12 @@
- 数据共享
- [数据共享概述](database/database-datashare-overview.md)
- [数据共享开发指导](database/database-datashare-guidelines.md)
- 文件管理
- 媒体库管理
- [媒体库开发概述](file-management/medialibrary-overview.md)
- [媒体资源使用指导](file-management/medialibrary-resource-guidelines.md)
- [文件路径使用指导](file-management/medialibrary-filepath-guidelines.md)
- [相册资源使用指导](file-management/medialibrary-album-guidelines.md)
- 任务管理
- 后台任务
- [后台任务概述](task-management/background-task-overview.md)
......@@ -254,12 +261,15 @@
- 振动
- [振动开发概述](device/vibrator-overview.md)
- [振动开发指导](device/vibrator-guidelines.md)
- 多模输入
- [输入设备开发指导](device/inputdevice-guidelines.md)
- [鼠标光标开发指导](device/pointerstyle-guidelines.md)
- 升级服务
- [示例服务器开发概述](device/sample-server-overview.md)
- [示例服务器开发指导](device/sample-server-guidelines.md)
- 设备使用信息统计
- [设备使用信息统计概述](device-usage-statistics/device-usage-statistics-overview.md)
- [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-dev-guide.md)
- [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-use-guide.md)
- DFX
- 应用事件打点
- [应用事件打点概述](dfx/hiappevent-overview.md)
......@@ -272,10 +282,15 @@
- [分布式跟踪开发指导](dfx/hitracechain-guidelines.md)
- 错误管理
- [错误管理开发指导](dfx/errormanager-guidelines.md)
- [应用恢复开发指导](dfx/apprecovery-guidelines.md)
- 国际化
- [国际化开发概述](internationalization/international-overview.md)
- [Intl开发指导](internationalization/intl-guidelines.md)
- [I18n开发指导](internationalization/i18n-guidelines.md)
- 应用测试
- [自动化测试框架使用指导](application-test/arkxtest-guidelines.md)
- [SmartPerf性能工具使用指导](application-test/smartperf-guidelines.md)
- [wukong稳定性工具使用指导](application-test/wukong-guidelines.md)
- 一次开发,多端部署
- [前言](key-features/multi-device-app-dev/foreword.md)
- [简介](key-features/multi-device-app-dev/introduction.md)
......@@ -329,6 +344,7 @@
- [Rawfile开发指导](napi/rawfile-guidelines.md)
- [Window开发指导](napi/native-window-guidelines.md)
- [使用MindSpore Lite引擎进行模型推理](napi/mindspore-lite-guidelines.md)
- [Neural Network Runtime对接AI推理框架开发指导](napi/neural-network-runtime-guidelines.md)
- 工具
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- 示例教程
......@@ -337,6 +353,7 @@
- API参考
- [Syscap列表](reference/syscap-list.md)
- 组件参考(基于ArkTS的声明式开发范式)
- [组件导读](reference/arkui-ts/ts-components-summary.md)
- 组件通用信息
- 通用事件
- [点击事件](reference/arkui-ts/ts-universal-events-click.md)
......@@ -402,6 +419,8 @@
- [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md)
- [Marquee](reference/arkui-ts/ts-basic-components-marquee.md)
- [Navigation](reference/arkui-ts/ts-basic-components-navigation.md)
- [NavRouter](reference/arkui-ts/ts-basic-components-navrouter.md)
- [NavDestination](reference/arkui-ts/ts-basic-components-navdestination.md)
- [PatternLock](reference/arkui-ts/ts-basic-components-patternlock.md)
- [PluginComponent](reference/arkui-ts/ts-basic-components-plugincomponent.md)
- [Progress](reference/arkui-ts/ts-basic-components-progress.md)
......@@ -435,6 +454,7 @@
- [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md)
- [Counter](reference/arkui-ts/ts-container-counter.md)
- [Flex](reference/arkui-ts/ts-container-flex.md)
- [FlowItem](reference/arkui-ts/ts-container-flowitem.md)
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- [GridCol](reference/arkui-ts/ts-container-gridcol.md)
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
......@@ -455,6 +475,7 @@
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- 媒体组件
- [Video](reference/arkui-ts/ts-media-components-video.md)
- 绘制组件
......@@ -483,7 +504,6 @@
- [组件内转场](reference/arkui-ts/ts-transition-animation-component.md)
- [共享元素转场](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [路径动画](reference/arkui-ts/ts-motion-path-animation.md)
- 全局UI方法
- 弹窗
- [警告弹窗](reference/arkui-ts/ts-methods-alert-dialog-box.md)
......@@ -493,8 +513,12 @@
- [时间选择弹窗](reference/arkui-ts/ts-methods-timepicker-dialog.md)
- [文本选择弹窗](reference/arkui-ts/ts-methods-textpicker-dialog.md)
- [菜单](reference/arkui-ts/ts-methods-menu.md)
- [应用级变量的状态管理](reference/arkui-ts/ts-state-management.md)
- [像素单位](reference/arkui-ts/ts-pixel-units.md)
- [枚举说明](reference/arkui-ts/ts-appendix-enums.md)
- [类型说明](reference/arkui-ts/ts-types.md)
- 已停止维护的组件
- [GridContainer(栅格)](reference/arkui-ts/ts-container-gridcontainer.md)
- 组件参考(兼容JS的类Web开发范式)
- 组件通用信息
- [通用属性](reference/arkui-js/js-components-common-attributes.md)
......@@ -590,12 +614,11 @@
- [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md)
- 自定义组件
- [基本用法](reference/arkui-js/js-components-custom-basic-usage.md)
- [数据传递与处理](reference/arkui-js/js-components-custom-props.md)
- [继承样式](reference/arkui-js/js-components-custom-style.md)
- [自定义事件](reference/arkui-js/js-components-custom-events.md)
- [Props](reference/arkui-js/js-components-custom-props.md)
- [事件参数](reference/arkui-js/js-components-custom-event-parameter.md)
- [slot插槽](reference/arkui-js/js-components-custom-slot.md)
- [生命周期定义](reference/arkui-js/js-components-custom-lifecycle.md)
- [动态创建组件](reference/arkui-js/js-components-create-elements.md)
- [数据类型说明](reference/arkui-js/js-appendix-types.md)
- JS服务卡片UI组件参考
- JS服务卡片UI框架说明
......@@ -603,9 +626,9 @@
- 语法
- [HML语法参考](reference/js-service-widget-ui/js-service-widget-syntax-hml.md)
- [CSS语法参考](reference/js-service-widget-ui/js-service-widget-syntax-css.md)
- [配置数据和事件](reference/js-service-widget-ui/js-service-widget-configuration.md)
- [多语言支持](reference/js-service-widget-ui/js-service-widget-multiple-languages.md)
- [低版本兼容](reference/js-service-widget-ui/js-service-widget-version-compatibility.md)
- [版本兼容适配](reference/js-service-widget-ui/js-service-widget-version-compatibility.md)
- [设置主题样式](reference/js-service-widget-ui/js-service-widget-theme.md)
- 组件
- 通用
- [通用属性](reference/js-service-widget-ui/js-service-widget-common-attributes.md)
......@@ -617,6 +640,7 @@
- [无障碍](reference/js-service-widget-ui/js-service-widget-common-accessibility.md)
- [原子布局](reference/js-service-widget-ui/js-service-widget-common-atomic-layout.md)
- 容器组件
- [badge](reference/js-service-widget-ui/js-service-widget-container-badge.md)
- [div](reference/js-service-widget-ui/js-service-widget-container-div.md)
- [list](reference/js-service-widget-ui/js-service-widget-container-list.md)
- [list-item](reference/js-service-widget-ui/js-service-widget-container-list-item.md)
......@@ -633,15 +657,13 @@
- [progress](reference/js-service-widget-ui/js-service-widget-basic-progress.md)
- [span](reference/js-service-widget-ui/js-service-widget-basic-span.md)
- [text](reference/js-service-widget-ui/js-service-widget-basic-text.md)
- 自定义组件
- [自定义组件基本用法](reference/js-service-widget-ui/js-service-widget-custom-basic-usage.md)
- [自定义事件](reference/js-service-widget-ui/js-service-widget-custom-events.md)
- [Props](reference/js-service-widget-ui/js-service-widget-custom-props.md)
- [自定义组件使用说明](reference/js-service-widget-ui/js-service-widget-custom-basic-usage.md)
- [数据类型说明](reference/js-service-widget-ui/js-service-widget-appendix-types.md)
- 接口参考(JS及TS API)
- [开发说明](reference/apis/development-intro.md)
- Ability框架
- FA模型
- [@ohos.ability.ability (Ability)](reference/apis/js-apis-ability-ability.md)
- [@ohos.ability.featureAbility (FeatureAbility模块)](reference/apis/js-apis-featureAbility.md)
- [@ohos.ability.particleAbility (particleAbility模块)](reference/apis/js-apis-particleAbility.md)
- [dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md)
......@@ -652,6 +674,7 @@
- [@ohos.application.AbilityStage (AbilityStage)](reference/apis/js-apis-application-abilitystage.md)
- [@ohos.application.abilityLifecycleCallback (AbilityLifecycleCallback)](reference/apis/js-apis-application-abilityLifecycleCallback.md)
- [@ohos.application.DataShareExtensionAbility (数据共享扩展能力)](reference/apis/js-apis-application-DataShareExtensionAbility.md)
- [@ohos.application.EnvironmentCallback (EnvironmentCallback)](reference/apis/js-apis-application-EnvironmentCallback.md)
- [@ohos.application.FormExtension (FormExtension)](reference/apis/js-apis-formextension.md)
- [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](reference/apis/js-apis-service-extension-ability.md)
- [@ohos.application.StartOptions (StartOptions)](reference/apis/js-apis-application-StartOptions.md)
......@@ -669,14 +692,12 @@
- [@ohos.ability.dataUriUtils (DataUriUtils模块)](reference/apis/js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode (ErrorCode)](reference/apis/js-apis-ability-errorCode.md)
- [@ohos.ability.wantConstant (wantConstant)](reference/apis/js-apis-ability-wantConstant.md)
- [@ohos.app.ability.appRecovery (appRecovery)](reference/apis/js-apis-app-ability-appRecovery.md)
- [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis/js-apis-abilityDelegatorRegistry.md)
- [@ohos.application.abilityManager (AbilityManager)](reference/apis/js-apis-application-abilityManager.md)
- [@ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionContext)](reference/apis/js-apis-accessibility-extension-context.md)
- [@ohos.application.AccessibilityExtensionAbility (辅助功能扩展能力)](reference/apis/js-apis-application-AccessibilityExtensionAbility.md)
- [@ohos.application.appManager (appManager)](reference/apis/js-apis-appmanager.md)
- [@ohos.application.Configuration (Configuration)](reference/apis/js-apis-configuration.md)
- [@ohos.application.ConfigurationConstant (ConfigurationConstant)](reference/apis/js-apis-configurationconstant.md)
- [@ohos.application.EnvironmentCallback (EnvironmentCallback)](reference/apis/js-apis-application-EnvironmentCallback.md)
- [@ohos.application.Configuration (Configuration)](reference/apis/js-apis-application-configuration.md)
- [@ohos.application.ConfigurationConstant (ConfigurationConstant)](reference/apis/js-apis-application-configurationConstant.md)
- [@ohos.application.errorManager (ErrorManager)](reference/apis/js-apis-errorManager.md)
- [@ohos.application.formBindingData (卡片数据绑定类)](reference/apis/js-apis-formbindingdata.md)
- [@ohos.application.formError (FormError)](reference/apis/js-apis-formerror.md)
......@@ -686,55 +707,55 @@
- [@ohos.application.missionManager (missionManager)](reference/apis/js-apis-missionManager.md)
- [@ohos.application.quickFixManager (quickFixManager)](reference/apis/js-apis-application-quickFixManager.md)
- [@ohos.application.Want (Want)](reference/apis/js-apis-application-Want.md)
- [@ohos.continuation.continuationManager (ContinuationExtraParams)](reference/apis/js-apis-continuation-continuationExtraParams.md)
- [@ohos.continuation.continuationManager (continuationManager)](reference/apis/js-apis-continuation-continuationManager.md)
- [@ohos.wantAgent (WantAgent模块)](reference/apis/js-apis-wantAgent.md)
- [abilityResult (AbilityResult)](reference/apis/js-apis-ability-abilityResult.md)
- [Want (Want)](reference/apis/js-apis-ability-Want.md)
- [abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md)
- [abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md)
- [abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md)
- [AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md)
- [ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md)
- [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md)
- [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md)
- [ProcessRunningInformation (ProcessRunningInformation)](reference/apis/js-apis-processrunninginformation.md)
- [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md)
- continuation/[ContinuationResult (ContinuationResult)](reference/apis/js-apis-continuation-continuationResult.md)
- [continuationExtraParams (ContinuationExtraParams)](reference/apis/js-apis-continuation-continuationExtraParams.md)
- [continuationResult (ContinuationResult)](reference/apis/js-apis-continuation-continuationResult.md)
- 公共事件与通知
- [@ohos.commonEvent (公共事件模块)](reference/apis/js-apis-commonEvent.md)
- [@ohos.commonEventManager (公共事件模块)](reference/apis/js-apis-commonEventManager.md)
- [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md)
- [@ohos.notification (Notification模块)](reference/apis/js-apis-notification.md)
- [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md)
- [EventHub (EventHub)](reference/apis/js-apis-eventhub.md)
- 应用程序包管理
- [@ohos.bundle (Bundle模块)](reference/apis/js-apis-Bundle.md)
- [@ohos.bundle.defaultAppManager (Bundle模块)](reference/apis/js-apis-bundle-defaultAppManager.md)
- [@ohos.bundle.innerBundleManager (innerBundleManager模块(JS端SDK接口))](reference/apis/js-apis-Bundle-InnerBundleManager.md)
- [@ohos.bundleState (设备使用信息统计)](reference/apis/js-apis-deviceUsageStatistics.md)
- [@ohos.distributedBundle (distributedBundle模块(JS端SDK接口))](reference/apis/js-apis-Bundle-distributedBundle.md)
- 包管理
- [@ohos.bundle.appControl(appControl模块)](reference/apis/js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager模块)](reference/apis/js-apis-bundleManager.md)
- [@ohos.bundle.bundleMonitor (bundleMonitor模块)](reference/apis/js-apis-bundleMonitor.md)
- [@ohos.bundle.defaultAppManager (默认应用管理)](reference/apis/js-apis-defaultAppManager.md)
- [@ohos.bundle.distributedBundle (distributedBundle模块)](reference/apis/js-apis-distributedBundle.md)
- [@ohos.bundle.freeInstall (freeInstall模块)](reference/apis/js-apis-freeInstall.md)
- [@ohos.bundle.installer (installer模块)](reference/apis/js-apis-installer.md)
- [@ohos.bundle.launcherBundleManager (launcherBundleManager模块)](reference/apis/js-apis-launcherBundleManager.md)
- [@ohos.zlib (Zip模块)](reference/apis/js-apis-zlib.md)
- [AbilityInfo (AbilityInfo)](reference/apis/js-apis-bundle-AbilityInfo.md)
- [ApplicationInfo (ApplicationInfo)](reference/apis/js-apis-bundle-ApplicationInfo.md)
- [BundleInfo (BundleInfo)](reference/apis/js-apis-bundle-BundleInfo.md)
- [BundleInstaller (BundleInstaller)](reference/apis/js-apis-bundle-BundleInstaller.md)
- [BundleStatusCallback (BundleStatusCallback)](reference/apis/js-apis-Bundle-BundleStatusCallback.md)
- [CustomizeData (CustomizeData)](reference/apis/js-apis-bundle-CustomizeData.md)
- [DispatchInfo (DispatchInfo)](reference/apis/js-apis-dispatchInfo.md)
- [ElementName (ElementName)](reference/apis/js-apis-bundle-ElementName.md)
- [ExtensionAbilityInfo (ExtensionAbilityInfo)](reference/apis/js-apis-bundle-ExtensionAbilityInfo.md)
- [HapModuleInfo (HapModuleInfo)](reference/apis/js-apis-bundle-HapModuleInfo.md)
- [LauncherAbilityInfo (LauncherAbilityInfo)](reference/apis/js-apis-bundle-LauncherAbilityInfo.md)
- [Metadata (Metadata)](reference/apis/js-apis-bundle-Metadata.md)
- [ModuleInfo (ModuleInfo)](reference/apis/js-apis-bundle-ModuleInfo.md)
- [PackInfo (PackInfo)](reference/apis/js-apis-bundle-PackInfo.md)
- [PermissionDef (PermissionDef)](reference/apis/js-apis-bundle-PermissionDef.md)
- [RemoteAbilityInfo (RemoteAbilityInfo)](reference/apis/js-apis-bundle-remoteAbilityInfo.md)
- [ShortcutInfo (ShortcutInfo)](reference/apis/js-apis-bundle-ShortcutInfo.md)
- [abilityInfo (AbilityInfo)](reference/apis/js-apis-bundleManager-abilityInfo.md)
- [applicationInfo (ApplicationInfo)](reference/apis/js-apis-bundleManager-applicationInfo.md)
- [bundleInfo (BundleInfo)](reference/apis/js-apis-bundleManager-bundleInfo.md)
- [dispatchInfo (DispatchInfo)](reference/apis/js-apis-bundleManager-dispatchInfo.md)
- [elementName (ElementName)](reference/apis/js-apis-bundleManager-elementName.md)
- [extensionAbilityInfo (ExtensionAbilityInfo)](reference/apis/js-apis-bundleManager-extensionAbilityInfo.md)
- [hapModuleInfo (HapModuleInfo)](reference/apis/js-apis-bundleManager-hapModuleInfo.md)
- [launcherAbilityInfo (LauncherAbilityInfo)](reference/apis/js-apis-bundleManager-launcherAbilityInfo.md)
- [metadata (Metadata)](reference/apis/js-apis-bundleManager-metadata.md)
- [packInfo (PackInfo)](reference/apis/js-apis-bundleManager-packInfo.md)
- [permissionDef (PermissionDef)](reference/apis/js-apis-bundleManager-permissionDef.md)
- [remoteAbilityInfo (RemoteAbilityInfo)](reference/apis/js-apis-bundleManager-remoteAbilityInfo.md)
- [shortcutInfo (ShortcutInfo)](reference/apis/js-apis-bundleManager-shortcutInfo.md)
- UI界面
- [@ohos.animator (动画)](reference/apis/js-apis-animator.md)
- [@ohos.curves (插值计算)](reference/apis/js-apis-curve.md)
- [@ohos.matrix4 (矩阵变换)](reference/apis/js-apis-matrix4.md)
- [@ohos.mediaquery (媒体查询)](reference/apis/js-apis-mediaquery.md)
- [@ohos.prompt (弹窗)](reference/apis/js-apis-prompt.md)
- [@ohos.promptAction (弹窗)](reference/apis/js-apis-promptAction.md)
- [@ohos.router (页面路由)](reference/apis/js-apis-router.md)
- [@ohos.uiAppearance(用户界面外观)](reference/apis/js-apis-uiappearance.md)
- 图形图像
- [@ohos.animation.windowAnimationManager (窗口动画管理)](reference/apis/js-apis-windowAnimationManager.md)
- [@ohos.display (屏幕属性)](reference/apis/js-apis-display.md)
......@@ -747,6 +768,7 @@
- [webgl2 (WebGL2)](reference/apis/js-apis-webgl2.md)
- 媒体
- [@ohos.multimedia.audio (音频管理)](reference/apis/js-apis-audio.md)
- [@ohos.multimedia.avsession (媒体会话管理)](reference/apis/js-apis-avsession.md)
- [@ohos.multimedia.camera (相机管理)](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image (图片处理)](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media (媒体服务)](reference/apis/js-apis-media.md)
......@@ -755,19 +777,16 @@
- [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md)
- [@ohos.resourceManager (资源管理)](reference/apis/js-apis-resource-manager.md)
- 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.distributedMissionManager (分布式任务管理)](reference/apis/js-apis-distributedMissionManager.md)
- [@ohos.workScheduler (延迟任务调度)](reference/apis/js-apis-workScheduler.md)
- [@ohos.reminderAgentManager (后台代理提醒)](reference/apis/js-apis-reminderAgentManager.md)
- [@ohos.resourceschedule.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-resourceschedule-backgroundTaskManager.md)
- [@ohos.resourceschedule.workScheduler (延迟任务调度)](reference/apis/js-apis-resourceschedule-workScheduler.md)
- [@ohos.resourceschedule.usageStatistics (设备使用信息统计)](reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理
- [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md)
- [@ohos.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](reference/apis/js-apis-enterprise-device-manager.md)
- [DeviceSettingsManager(设备设置管理)](reference/apis/js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)
- 安全
- [@ohos.abilityAccessCtrl (访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md)
- [@ohos.abilityAccessCtrl (程序访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md)
- [@ohos.privacyManager (隐私管理)](reference/apis/js-apis-privacyManager.md)
- [@ohos.security.cryptoFramework (加密算法库框架)](reference/apis/js-apis-cryptoFramework.md)
- [@ohos.security.cryptoFramework (加密算法库框架)](reference/apis/js-apis-cryptoFramework.md)
- [@ohos.security.huks (通用密钥库系统)](reference/apis/js-apis-huks.md)
- [@ohos.userIAM.faceAuth (人脸认证)](reference/apis/js-apis-useriam-faceauth.md)
- [@ohos.userIAM.userAuth (用户认证)](reference/apis/js-apis-useriam-userauth.md)
......@@ -777,19 +796,18 @@
- [@ohos.data.dataShare (数据共享)](reference/apis/js-apis-data-dataShare.md)
- [@ohos.data.dataSharePredicates (数据共享谓词)](reference/apis/js-apis-data-dataSharePredicates.md)
- [@ohos.data.dataShareResultSet (数据共享结果集)](reference/apis/js-apis-data-DataShareResultSet.md)
- [@ohos.data.distributedData (分布式数据管理)](reference/apis/js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject (分布式数据对象)](reference/apis/js-apis-data-distributedobject.md)
- [@ohos.data.distributedKVStore (分布式键值数据库)](reference/apis/js-apis-distributedKVStore.md)
- [@ohos.data.preferences (首选项)](reference/apis/js-apis-data-preferences.md)
- [@ohos.data.rdb (关系型数据库)](reference/apis/js-apis-data-rdb.md)
- [@ohos.data.ValuesBucket (数据集)](reference/apis/js-apis-data-ValuesBucket.md)
- [resultSet (结果集)](reference/apis/js-apis-data-resultset.md)
- 文件管理
- [@ohos.data.fileAccess (公共文件访问与管理)](reference/apis/js-apis-fileAccess.md)
- [@ohos.document (文件交互)](reference/apis/js-apis-document.md)
- [@ohos.environment (目录环境能力)](reference/apis/js-apis-environment.md)
- [@ohos.data.fileAccess (公共文件访问与管理)](reference/apis/js-apis-fileAccess.md)
- [@ohos.fileExtensionInfo (公共文件访问与管理属性信息)](reference/apis/js-apis-fileExtensionInfo.md)
- [@ohos.fileio (文件管理)](reference/apis/js-apis-fileio.md)
- [@ohos.filemanagement.userfile_manager (用户数据管理)](reference/apis/js-apis-userfilemanager.md)
- [@ohos.filemanagement.userFileManager (用户数据管理)](reference/apis/js-apis-userFileManager.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](reference/apis/js-apis-medialibrary.md)
- [@ohos.securityLabel (数据标签)](reference/apis/js-apis-securityLabel.md)
- [@ohos.statfs (statfs)](reference/apis/js-apis-statfs.md)
......@@ -807,11 +825,8 @@
- [@ohos.net.connection (网络连接管理)](reference/apis/js-apis-net-connection.md)
- [@ohos.net.ethernet (以太网连接管理)](reference/apis/js-apis-net-ethernet.md)
- [@ohos.net.http (数据请求)](reference/apis/js-apis-http.md)
- [@ohos.net.policy (网络策略管理)](reference/apis/js-apis-net-policy.md)
- [@ohos.net.sharing (网络共享管理)](reference/apis/js-apis-net-sharing.md)
- [@ohos.net.socket (Socket连接)](reference/apis/js-apis-socket.md)
- [@ohos.net.statistics (网络流量管理)](reference/apis/js-apis-net-statistics.md)
- [@ohos.net.tlsSocket (TLSSocket连接)](reference/apis/js-apis-tlsSocket.md)
- [@ohos.net.webSocket (WebSocket连接)](reference/apis/js-apis-webSocket.md)
- [@ohos.request (上传下载)](reference/apis/js-apis-request.md)
- 通信与连接
......@@ -822,40 +837,49 @@
- [@ohos.nfc.tag (标准NFC-Tag)](reference/apis/js-apis-nfcTag.md)
- [@ohos.rpc (RPC通信)](reference/apis/js-apis-rpc.md)
- [@ohos.wifi (WLAN)](reference/apis/js-apis-wifi.md)
- [@ohos.wifiext (WLAN)](reference/apis/js-apis-wifiext.md)
- [@ohos.wifiext (WLAN扩展接口)](reference/apis/js-apis-wifiext.md)
- [nfctech (标准NFC-Tag Nfc 技术)](reference/apis/js-apis-nfctech.md)
- [tagSession (标准NFC-Tag TagSession)](reference/apis/js-apis-tagSession.md)
- 系统基础能力
- [@ohos.accessibility (辅助功能)](reference/apis/js-apis-accessibility.md)
- [@ohos.accessibility.config (系统辅助功能配置)](reference/apis/js-apis-accessibility-config.md)
- [@ohos.accessibility.GesturePath (手势路径)](reference/apis/js-apis-accessibility-GesturePath.md)
- [@ohos.accessibility.GesturePoint (手势触摸点)](reference/apis/js-apis-accessibility-GesturePoint.md)
- [@ohos.application.AccessibilityExtensionAbility (辅助功能扩展能力)](reference/apis/js-apis-application-AccessibilityExtensionAbility.md)
- [@ohos.faultLogger (故障日志获取)](reference/apis/js-apis-faultLogger.md)
- [@ohos.hiAppEvent (应用打点)](reference/apis/js-apis-hiappevent.md)
- [@ohos.hichecker (检测模式)](reference/apis/js-apis-hichecker.md)
- [@ohos.hidebug (Debug调试)](reference/apis/js-apis-hidebug.md)
- [@ohos.hilog (日志打印)](reference/apis/js-apis-hilog.md)
- [@ohos.hilog (HiLog日志打印)](reference/apis/js-apis-hilog.md)
- [@ohos.hiSysEvent (系统事件打点)](reference/apis/js-apis-hisysevent.md)
- [@ohos.hiTraceChain (分布式跟踪)](reference/apis/js-apis-hitracechain.md)
- [@ohos.hiTraceMeter (性能打点)](reference/apis/js-apis-hitracemeter.md)
- [@ohos.hiviewdfx.hiAppEvent (应用事件打点)](reference/apis/js-apis-hiviewdfx-hiappevent.md)
- [@ohos.inputmethod (输入法框架)](reference/apis/js-apis-inputmethod.md)
- [@ohos.inputmethodengine (输入法服务)](reference/apis/js-apis-inputmethodengine.md)
- [@ohos.inputmethodextensionability (InputMethodExtensionAbility)](reference/apis/js-apis-inputmethod-extension-ability.md)
- [@ohos.inputmethodextensioncontext (InputMethodExtensionContext)](reference/apis/js-apis-inputmethod-extension-context.md)
- [@ohos.inputmethodsubtype(输入法子类型)](reference/apis/js-apis-inputmethod-subtype.md)
- [@ohos.pasteboard (剪贴板)](reference/apis/js-apis-pasteboard.md)
- [@ohos.screenLock (锁屏管理)](reference/apis/js-apis-screen-lock.md)
- [@ohos.systemTime (系统时间、时区)](reference/apis/js-apis-system-time.md)
- [@ohos.systemTimer(系统定时器)](reference/apis/js-apis-system-timer.md)
- [@ohos.wallpaper (壁纸)](reference/apis/js-apis-wallpaper.md)
- [@ohos.web.webview(Web)](reference/apis/js-apis-webview.md)
- [console (日志打印)](reference/apis/js-apis-logs.md)
- [Timer (定时器)](reference/apis/js-apis-timer.md)
- [AccessibilityExtensionContext (辅助功能扩展上下文)](reference/apis/js-apis-accessibility-extension-context.md)
- 设备管理
- [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md)
- [@ohos.batteryStatistics (耗电统计)](reference/apis/js-apis-batteryStatistics.md)
- [@ohos.brightness (屏幕亮度)](reference/apis/js-apis-brightness.md)
- [@ohos.deviceInfo (设备信息)](reference/apis/js-apis-device-info.md)
- [@ohos.distributedHardware.deviceManager (设备管理)](reference/apis/js-apis-device-manager.md)
- [@ohos.geolocation (位置服务)](reference/apis/js-apis-geolocation.md)
- [@ohos.geoLocationManager (位置服务)](reference/apis/js-apis-geoLocationManager.md)
- [@ohos.multimodalInput.inputConsumer (组合按键)](reference/apis/js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice (输入设备)](reference/apis/js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputDeviceCooperate (键鼠穿越)](reference/apis/js-apis-cooperate.md)
- [@ohos.multimodalInput.inputEvent (输入事件)](reference/apis/js-apis-inputevent.md)
- [@ohos.multimodalInput.inputEventClient (注入按键)](reference/apis/js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputEventClient (按键注入)](reference/apis/js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputMonitor (输入监听)](reference/apis/js-apis-inputmonitor.md)
- [@ohos.multimodalInput.keyCode (键值)](reference/apis/js-apis-keycode.md)
- [@ohos.multimodalInput.keyEvent (按键输入事件)](reference/apis/js-apis-keyevent.md)
......@@ -866,15 +890,21 @@
- [@ohos.runningLock (Runninglock锁)](reference/apis/js-apis-runninglock.md)
- [@ohos.sensor (传感器)](reference/apis/js-apis-sensor.md)
- [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md)
- [@ohos.systemParameter (系统属性)](reference/apis/js-apis-system-parameter.md)
- [@ohos.systemCapability (系统能力)](reference/apis/js-apis-system-capability.md)
- [@ohos.systemParameterV9 (系统属性)](reference/apis/js-apis-system-parameterV9.md)
- [@ohos.thermal (热管理)](reference/apis/js-apis-thermal.md)
- [@ohos.update (升级)](reference/apis/js-apis-update.md)
- [@ohos.usb (USB管理)](reference/apis/js-apis-usb.md)
- [@ohos.usbV9 (USB管理)](reference/apis/js-apis-usb.md)
- [@ohos.vibrator (振动)](reference/apis/js-apis-vibrator.md)
- 帐号管理
- [@ohos.account.appAccount (应用帐号管理)](reference/apis/js-apis-appAccount.md)
- [@ohos.account.distributedAccount (分布式帐号管理)](reference/apis/js-apis-distributed-account.md)
- [@ohos.account.osAccount (系统帐号管理)](reference/apis/js-apis-osAccount.md)
- 定制管理
- [@ohos.configPolicy (配置策略)](reference/apis/js-apis-configPolicy.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.adminManager (企业设备管理)](reference/apis/js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.dateTimeManager(系统时间管理)](reference/apis/js-apis-enterprise-dateTimeManager.md)
- 语言基础类库
- [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md)
- [@ohos.convertxml (xml转换JavaScript)](reference/apis/js-apis-convertxml.md)
......@@ -902,8 +932,22 @@
- [@ohos.application.testRunner (TestRunner)](reference/apis/js-apis-testRunner.md)
- [@ohos.uitest (UiTest)](reference/apis/js-apis-uitest.md)
- 已停止维护的接口
- [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.bundle (Bundle模块)](reference/apis/js-apis-Bundle.md)
- [@ohos.bundle.innerBundleManager (innerBundleManager模块)](reference/apis/js-apis-Bundle-InnerBundleManager.md)
- [@ohos.bundleState (设备使用信息统计)](reference/apis/js-apis-deviceUsageStatistics.md)
- [@ohos.bytrace (性能打点)](reference/apis/js-apis-bytrace.md)
- [@ohos.commonEvent (公共事件模块)](reference/apis/js-apis-commonEvent.md)
- [@ohos.data.storage (轻量级存储)](reference/apis/js-apis-data-storage.md)
- [@ohos.data.distributedData (分布式数据管理)](reference/apis/js-apis-distributed-data.md)
- [@ohos.distributedBundle (分布式包管理)](reference/apis/js-apis-Bundle-distributedBundle.md)
- [@ohos.document (文件交互)](reference/apis/js-apis-document.md)
- [@ohos.geolocation (位置服务)](reference/apis/js-apis-geolocation.md)
- [@ohos.hiAppEvent (应用打点)](reference/apis/js-apis-hiappevent.md)
- [@ohos.prompt (弹窗)](reference/apis/js-apis-prompt.md)
- [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md)
- [@ohos.systemParameter (系统属性)](reference/apis/js-apis-system-parameter.md)
- [@ohos.usb (USB管理)](reference/apis/js-apis-usb-deprecated.md)
- [@system.app (应用上下文)](reference/apis/js-apis-system-app.md)
- [@system.battery (电量信息)](reference/apis/js-apis-system-battery.md)
- [@system.bluetooth (蓝牙)](reference/apis/js-apis-system-bluetooth.md)
......@@ -923,8 +967,100 @@
- [@system.sensor (传感器)](reference/apis/js-apis-system-sensor.md)
- [@system.storage (数据存储)](reference/apis/js-apis-system-storage.md)
- [@system.vibrator (振动)](reference/apis/js-apis-system-vibrate.md)
- [console (日志打印)](reference/apis/js-apis-logs.md)
- [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md)
- [abilityInfo (AbilityInfo)](reference/apis/js-apis-bundle-AbilityInfo.md)
- [applicationInfo (ApplicationInfo)](reference/apis/js-apis-bundle-ApplicationInfo.md)
- [bundleInfo (BundleInfo)](reference/apis/js-apis-bundle-BundleInfo.md)
- [bundleInstaller (BundleInstaller)](reference/apis/js-apis-bundle-BundleInstaller.md)
- [bundleStatusCallback (BundleStatusCallback)](reference/apis/js-apis-Bundle-BundleStatusCallback.md)
- [customizeData (CustomizeData)](reference/apis/js-apis-bundle-CustomizeData.md)
- [elementName (ElementName)](reference/apis/js-apis-bundle-ElementName.md)
- [hapModuleInfo (HapModuleInfo)](reference/apis/js-apis-bundle-HapModuleInfo.md)
- [launcherAbilityInfo (LauncherAbilityInfo)](reference/apis/js-apis-bundle-LauncherAbilityInfo.md)
- [moduleInfo (ModuleInfo)](reference/apis/js-apis-bundle-ModuleInfo.md)
- [PermissionDef (PermissionDef)](reference/apis/js-apis-bundle-PermissionDef.md)
- [remoteAbilityInfo (RemoteAbilityInfo)](reference/apis/js-apis-bundle-remoteAbilityInfo.md)
- [shortcutInfo (shortcutInfo)](reference/apis/js-apis-bundle-ShortcutInfo.md)
- 错误码参考
- [通用错误码](reference/errorcodes/errorcode-universal.md)
- Ability框架
- [元能力子系统错误码](reference/errorcodes/errorcode-ability.md)
- [DistributedSchedule错误码](reference/errorcodes/errorcode-DistributedSchedule.md)
- 包管理
- [包管理子系统通用错误码](reference/errorcodes/errorcode-bundle.md)
- [zlib子系统错误码](reference/errorcodes/errorcode-zlib.md)
- 公共事件与通知
- [事件错误码](reference/errorcodes/errorcode-CommonEventService.md)
- [DistributedNotificationService错误码](reference/errorcodes/errorcode-DistributedNotificationService.md)
- UI界面
- [动画错误码](reference/errorcodes/errorcode-animator.md)
- [弹窗错误码](reference/errorcodes/errorcode-promptAction.md)
- [页面路由错误码](reference/errorcodes/errorcode-router.md)
- 图形图像
- [色彩管理错误码](reference/errorcodes/errorcode-colorspace-manager.md)
- [屏幕错误码](reference/errorcodes/errorcode-display.md)
- [窗口错误码](reference/errorcodes/errorcode-window.md)
- 媒体
- [Audio错误码](reference/errorcodes/errorcode-audio.md)
- [媒体会话管理错误码](reference/errorcodes/errorcode-avsession.md)
- 资源管理
- [I18n错误码](reference/errorcodes/errorcode-i18n.md)
- [资源管理错误码](reference/errorcodes/errorcode-resource-manager.md)
- 资源调度
- [backgroundTaskManager错误码](reference/errorcodes/errorcode-backgroundTaskMgr.md)
- [DeviceUsageStatistics错误码](reference/errorcodes/errorcode-DeviceUsageStatistics.md)
- [reminderAgentManager错误码](reference/errorcodes/errorcode-reminderAgentManager.md)
- [workScheduler错误码](reference/errorcodes/errorcode-workScheduler.md)
- 安全
- [AccessToken错误码](reference/errorcodes/errorcode-access-token.md)
- [HUKS错误码](reference/errorcodes/errorcode-huks.md)
- [用户认证错误码](reference/errorcodes/errorcode-useriam.md)
- 数据管理
- [关系型数据库错误码](reference/errorcodes/errorcode-data-rdb.md)
- [数据共享错误码](reference/errorcodes/errorcode-datashare.md)
- [分布式数据对象错误码](reference/errorcodes/errorcode-distributed-dataObject.md)
- [分布式键值数据库错误码](reference/errorcodes/errorcode-distributedKVStore.md)
- [首选项错误码](reference/errorcodes/errorcode-preferences.md)
- 文件管理
- [文件管理子系统错误码](reference/errorcodes/errorcode-filemanagement.md)
- 网络管理
- [上传下载错误码](reference/errorcodes/errorcode-request.md)
- 通信与连接
- [NFC错误码](reference/errorcodes/errorcode-nfc.md)
- [RPC错误码](reference/errorcodes/errorcode-rpc.md)
- 系统基础能力
- [无障碍子系统错误码](reference/errorcodes/errorcode-accessibility.md)
- [Faultlogger错误码](reference/errorcodes/errorcode-faultlogger.md)
- [应用事件打点错误码](reference/errorcodes/errorcode-hiappevent.md)
- [系统事件错误码](reference/errorcodes/errorcode-hisysevent.md)
- [Hidebug错误码](reference/errorcodes/errorcode-hiviewdfx-hidebug.md)
- [输入法框架错误码](reference/errorcodes/errorcode-inputmethod-framework.md)
- [剪贴板错误码](reference/errorcodes/errorcode-pasteboard.md)
- [Webview错误码](reference/errorcodes/errorcode-webview.md)
- 帐号管理
- [Account错误码](reference/errorcodes/errorcode-account.md)
- [应用帐号错误码](reference/errorcodes/errorcode-app-account.md)
- 设备管理
- [耗电统计错误码](reference/errorcodes/errorcode-batteryStatistics.md)
- [屏幕亮度错误码](reference/errorcodes/errorcode-brightness.md)
- [系统电源管理错误码](reference/errorcodes/errorcode-power.md)
- [RunningLock锁错误码](reference/errorcodes/errorcode-runninglock.md)
- [热管理错误码](reference/errorcodes/errorcode-thermal.md)
- [设备管理错误码](reference/errorcodes/errorcode-device-manager.md)
- [位置服务子系统错误码](reference/errorcodes/errorcode-geoLocationManager.md)
- [键鼠穿越管理错误码](reference/errorcodes/errorcode-multimodalinput.md)
- [传感器错误码](reference/errorcodes/errorcode-sensor.md)
- [振动错误码](reference/errorcodes/errorcode-vibrator.md)
- [系统参数错误码](reference/errorcodes/errorcode-system-parameterV9.md)
- [USB服务错误码](reference/errorcodes/errorcode-usb.md)
- [升级错误码](reference/errorcodes/errorcode-update.md)
- 定制管理
- [企业设备管理错误码](reference/errorcodes/errorcode-enterpriseDeviceManager.md)
- 语言基础类库
- [buffer错误码](reference/errorcodes/errorcode-buffer.md)
- [containers错误码](reference/errorcodes/errorcode-containers.md)
- 测试
- [uitest错误码](reference/errorcodes/errorcode-uitest.md)
- 接口参考(Native API)
- 模块
- [Native XComponent](reference/native-apis/_o_h___native_x_component.md)
......@@ -937,6 +1073,7 @@
- [Image](reference/native-apis/image.md)
- [Rawfile](reference/native-apis/rawfile.md)
- [MindSpore](reference/native-apis/_mind_spore.md)
- [NeuralNeworkRuntime](reference/native-apis/_neural_nework_runtime.md)
- 头文件
- [drawing_bitmap.h](reference/native-apis/drawing__bitmap_8h.md)
- [drawing_brush.h](reference/native-apis/drawing__brush_8h.md)
......@@ -965,6 +1102,8 @@
- [status.h](reference/native-apis/status_8h.md)
- [tensor.h](reference/native-apis/tensor_8h.md)
- [types.h](reference/native-apis/types_8h.md)
- [neural_network_runtime_type.h](reference/native-apis/neural__network__runtime__type_8h.md)
- [neural_network_runtime.h](reference/native-apis/neural__network__runtime_8h.md)
- 结构体
- [OH_Drawing_BitmapFormat](reference/native-apis/_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](reference/native-apis/_o_h___native_buffer___config.md)
......@@ -982,6 +1121,10 @@
- [OH_AI_CallBackParam](reference/native-apis/_o_h___a_i___call_back_param.md)
- [OH_AI_ShapeInfo](reference/native-apis/_o_h___a_i___shape_info.md)
- [OH_AI_TensorHandleArray](reference/native-apis/_o_h___a_i___tensor_handle_array.md)
- [OH_NN_Memory](reference/native-apis/_o_h___n_n___memory.md)
- [OH_NN_QuantParam](reference/native-apis/_o_h___n_n___quant_param.md)
- [OH_NN_Tensor](reference/native-apis/_o_h___n_n___tensor.md)
- [OH_NN_UInt32Array](reference/native-apis/_o_h___n_n___u_int32_array.md)
- 标准库
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [libuv](reference/native-lib/third_party_libuv/libuv.md)
......@@ -992,14 +1135,21 @@
- [Native api中导出的OpenGL ES 3.0符号列表](reference/native-lib/third_party_opengl/openglesv3-symbol.md)
- 常见问题
- [full-SDK替换指南](quick-start/full-sdk-switch-guide.md)
- [开发语言常见问题](faqs/faqs-language.md)
- [Ability框架开发常见问题](faqs/faqs-ability.md)
- [应用程序包管理开发常见问题](faqs/faqs-bundle.md)
- [ArkUI组件(ArkTS)开发常见问题](faqs/faqs-ui-ets.md)
- [ArkUI Web组件(ArkTS)开发常见问题](faqs/faqs-web-arkts.md)
- [UI框架(JS)开发常见问题](faqs/faqs-ui-js.md)
- [UI框架(ArkTS)开发常见问题](faqs/faqs-ui-ets.md)
- [公共事件与通知开发常见问题](faqs/faqs-event-notification.md)
- [图形图像开发常见问题](faqs/faqs-graphics.md)
- [文件管理开发常见问题](faqs/faqs-file-management.md)
- [媒体开发常见问题](faqs/faqs-media.md)
- [网络与连接开发常见问题](faqs/faqs-connectivity.md)
- [数据管理开发常见问题](faqs/faqs-data-management.md)
- [设备管理开发常见问题](faqs/faqs-device-management.md)
- [DFX开发常见问题](faqs/faqs-dfx.md)
- [国际化开发常见问题](faqs/faqs-international.md)
- [Native API使用常见问题](faqs/faqs-native.md)
- [三四方库使用常见问题](faqs/faqs-third-party-library.md)
- [IDE使用常见问题](faqs/faqs-ide.md)
......
# OpenHarmony安全测试规范
本文档主要参考业界安全测试标准和最佳实践,提供OpenHarmony安全测试规范,用于指导开发人员/测试人员进行安全测试。
## 1 安全测试内容
1、各模块依据[OpenHarmony C&C++安全编程指南](OpenHarmony-c-cpp-secure-coding-guide.md),进行代码安全检视,检视问题均需要修复。
2、通过OpenHarmony代码门禁安全扫描工具测试,扫描告警结果清零。
3、依据[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig-buildsystem/编译规范.md),使用编译选项扫描工具检查二进制文件编译选项开启情况,二进制文件编译选项均需要符合规范要求。
4、针对接收并处理用户态参数模块,开发人员需依据[Fuzz测试框架](https://gitee.com/openharmony/test_developertest/tree/master/libs/fuzzlib)开发灰白盒Fuzz测试套,并完成灰白盒Fuzz测试验证。
5、针对开源组件使用业界漏洞扫描工具扫描,开源组件漏洞均已按照社区漏洞管理流程修复。
## 安全编码测试
6、针对发布版本进行一致性验证,在[版本发布网站](../release-notes/Readme.md)中检查版本镜像是否提供SAH256校验码。
1、各模块依据[OpenHarmony安全编码规范](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md),进行代码安全检视
7、各模块依据[OpenHarmony安全设计规范](OpenHarmony-security-design-guide.md),结合业务完成安全设计自检验证,自检设计问题均需要修复
2、使用安全编码扫描工具扫描测试,扫描告警结果清零。OpenHarmony代码门禁已集成安全编码扫描工具
8、使用主流病毒扫描软件扫描软件包,病毒扫描结果均修复或确认为工具误报
9、在代码中搜索“.cer”、“.pem”等证书秘钥格式或者“PRIVATE KEY”等证书秘钥证书关键词找到证书秘钥,检查证书秘钥是否在有效期内,加密算法是否符合[加密算法要求](OpenHarmony-security-design-guide.md#3加密),证书秘钥问题均需要修复。
## 安全设计验证
10、针对暴露用户态接口进行黑盒Fuzz,包括但不限于系统服务接口、内核驱动接口、socket网络接口。
1、各模块依据[OpenHarmony安全设计规范](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-security-design-guide.md),结合业务完成安全设计自检验证
>说明:上述要求不区分继承特性及新需求
## 2 安全测试完成要求
版本发布前需进行安全测试,安全测试完成标准如下:
## 安全测试工具扫描
1、上述章节中各项安全测试内容执行完成。
1、针对高风险模块,开发人员需要依据[Fuzz测试框架](https://gitee.com/openharmony/test_developertest/tree/master/libs/fuzzlib)开发灰白盒Fuzz测试套,并完成灰白盒Fuzz测试
2、安全问题均已关闭
2、针对暴露用户态接口进行黑盒Fuzz,包括但不限于系统服务接口、内核驱动接口、socket网络接口。
## 3 安全测试报告模板
3、依据[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig-buildsystem/%E7%BC%96%E8%AF%91%E8%A7%84%E8%8C%83.md),使用编译选项扫描工具检查文件编译选项开启情况。
1、安全测试报告需包含第1章节安全测试各项结果,需包含未关闭安全问题情况。
4、针对开源组件使用业界漏洞扫描工具扫描,开源组件漏洞均已按照社区漏洞管理流程修复。
\ No newline at end of file
2、版本安全测试报告无需单独发布和归档,随版本整体测试报告发布。
\ No newline at end of file
......@@ -30,6 +30,10 @@
若要引入新的第三方开源软件到OpenHarmony项目中,请参考[第三方开源软件引入指导](第三方开源软件引入指导.md)
### 测试规范
[OpenHarmony安全测试规范](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-security-test-guide.md)
## 贡献工作流<a name="section15769105812369"></a>
有关详细信息,请参考[贡献流程](贡献流程.md)
......@@ -45,4 +49,3 @@
- [安全问题处理和发布流程](https://gitee.com/openharmony/security/blob/master/zh/security-process/README.md)
- [安全和披露说明](https://gitee.com/openharmony/security/blob/master/zh/security-process/security-disclosure.md)
# xxx子系统ChangeLog
相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。
## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字)
每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。
以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。
如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。
**变更影响**
是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。
是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
列举此功能变更涉及的接口/组件变更。
**适配指导(可选,不涉及则可以删除)**
提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。
例:
在xxx文件中将xxx参数修改为xxx。
```
sample code
```
# xxx子系统ChangeLog
相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。
## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字)
每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。
以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。
如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。
**变更影响**
是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。
是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
列举此功能变更涉及的接口/组件变更。
**适配指导(可选,不涉及则可以删除)**
提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。
例:
在xxx文件中将xxx参数修改为xxx。
```
sample code
```
# xxx子系统ChangeLog
相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。
## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字)
每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。
以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。
如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。
**变更影响**
是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。
是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。
**关键的接口/组件变更**
列举此功能变更涉及的接口/组件变更。
**适配指导(可选,不涉及则可以删除)**
提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。
例:
在xxx文件中将xxx参数修改为xxx。
```
sample code
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册