Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3a1e4d85
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3a1e4d85
编写于
12月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12023 问题修改
Merge pull request !12023 from 葛亚芳/master
上级
065bfab5
1481f00f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
576 addition
and
380 deletion
+576
-380
zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md
...ice-usage-statistics/device-usage-statistics-use-guide.md
+3
-1
zh-cn/application-dev/reference/apis/js-apis-process.md
zh-cn/application-dev/reference/apis/js-apis-process.md
+48
-27
zh-cn/application-dev/reference/apis/js-apis-url.md
zh-cn/application-dev/reference/apis/js-apis-url.md
+63
-45
zh-cn/application-dev/reference/apis/js-apis-util.md
zh-cn/application-dev/reference/apis/js-apis-util.md
+462
-307
未找到文件。
zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md
浏览文件 @
3a1e4d85
...
@@ -535,6 +535,8 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics';
...
@@ -535,6 +535,8 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics';
}
}
```
```
## 相关实例
## 相关实例
针对设备使用信息统计,有以下相关实例可供参考:
针对设备使用信息统计,有以下相关实例可供参考:
-
[
`DeviceUsageStatistics`:设备使用信息统计(eTS)(API8)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/device/DeviceUsageStatistics
)
-
[
`DeviceUsageStatistics`:设备使用信息统计(ArkTS)(API8)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/device/DeviceUsageStatistics
)
zh-cn/application-dev/reference/apis/js-apis-process.md
浏览文件 @
3a1e4d85
# 获取进程相关的信息
# 获取进程相关的信息
>  **说明:**
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...
@@ -17,13 +18,13 @@ import process from '@ohos.process';
...
@@ -17,13 +18,13 @@ import process from '@ohos.process';
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| egid | number | 是 | 否 | 进程的有效组标识。
该接口为系统接口,三方应用不支持调用。
|
| egid | number | 是 | 否 | 进程的有效组标识。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试。
|
| euid | number | 是 | 否 | 进程的有效用户身份。
该接口为系统接口,三方应用不支持调用
。 |
| euid | number | 是 | 否 | 进程的有效用户身份。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
| gid | number | 是 | 否 | 进程的组标识。
该接口为系统接口,三方应用不支持调用。
|
| gid | number | 是 | 否 | 进程的组标识。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试。
|
| uid | number | 是 | 否 | 进程的用户标识。 |
| uid | number | 是 | 否 | 进程的用户标识。 |
| groups | number[] | 是 | 否 | 带有补充组id的数组。
该接口为系统接口,三方应用不支持调用
。 |
| groups | number[] | 是 | 否 | 带有补充组id的数组。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
| pid | number | 是 | 否 | 当前进程的pid。 |
| pid | number | 是 | 否 | 当前进程的pid。 |
| ppid | number | 是 | 否 | 当前进程的父进程的pid。
该接口为系统接口,三方应用不支持调用
。 |
| ppid | number | 是 | 否 | 当前进程的父进程的pid。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
| tid
<sup>
8+
</sup>
| number | 是 | 否 | 当前进程的tid。 |
| tid
<sup>
8+
</sup>
| number | 是 | 否 | 当前进程的tid。 |
...
@@ -31,7 +32,7 @@ import process from '@ohos.process';
...
@@ -31,7 +32,7 @@ import process from '@ohos.process';
提供用于新增进程的抛异常接口。
提供用于新增进程的抛异常接口。
###
process.
isAppUid<sup>9+</sup>
### isAppUid<sup>9+</sup>
isAppUid(v: number): boolean
isAppUid(v: number): boolean
...
@@ -59,7 +60,7 @@ let result = pro.isAppUid(688);
...
@@ -59,7 +60,7 @@ let result = pro.isAppUid(688);
```
```
###
process.
getUidForName<sup>9+</sup>
### getUidForName<sup>9+</sup>
getUidForName(v: string): number
getUidForName(v: string): number
...
@@ -87,7 +88,7 @@ let pres = pro .getUidForName("tool");
...
@@ -87,7 +88,7 @@ let pres = pro .getUidForName("tool");
```
```
###
process.
getThreadPriority<sup>9+</sup>
### getThreadPriority<sup>9+</sup>
getThreadPriority(v: number): number
getThreadPriority(v: number): number
...
@@ -116,7 +117,7 @@ let pres = pro.getThreadPriority(tid);
...
@@ -116,7 +117,7 @@ let pres = pro.getThreadPriority(tid);
```
```
###
process.
getSystemConfig<sup>9+</sup>
### getSystemConfig<sup>9+</sup>
getSystemConfig(name: number): number
getSystemConfig(name: number): number
...
@@ -145,7 +146,7 @@ let pres = pro.getSystemConfig(_SC_ARG_MAX);
...
@@ -145,7 +146,7 @@ let pres = pro.getSystemConfig(_SC_ARG_MAX);
```
```
###
process.
getEnvironmentVar<sup>9+</sup>
### getEnvironmentVar<sup>9+</sup>
getEnvironmentVar(name: string): string
getEnvironmentVar(name: string): string
...
@@ -173,7 +174,7 @@ let pres = pro.getEnvironmentVar("PATH");
...
@@ -173,7 +174,7 @@ let pres = pro.getEnvironmentVar("PATH");
```
```
###
process.
exit<sup>9+</sup>
### exit<sup>9+</sup>
exit(code: number): void
exit(code: number): void
...
@@ -197,7 +198,7 @@ pro.exit(0);
...
@@ -197,7 +198,7 @@ pro.exit(0);
```
```
###
process.
kill<sup>9+</sup>
### kill<sup>9+</sup>
kill(signal: number, pid: number): boolean
kill(signal: number, pid: number): boolean
...
@@ -237,10 +238,10 @@ let result = pro.kill(28, pres);
...
@@ -237,10 +238,10 @@ let result = pro.kill(28, pres);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| pid | number | 是 | 否 | 子进程的pid。
该接口为系统接口,三方应用不支持调用
。 |
| pid | number | 是 | 否 | 子进程的pid。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
| ppid | number | 是 | 否 | 子进程的父进程的pid。
该接口为系统接口,三方应用不支持调用
。 |
| ppid | number | 是 | 否 | 子进程的父进程的pid。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
| exitCode | number | 是 | 否 | 子进程的退出码。
该接口为系统接口,三方应用不支持调用。
|
| exitCode | number | 是 | 否 | 子进程的退出码。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试。
|
| killed | boolean | 是 | 否 | 父进程给子进程发信号是否成功。
该接口为系统接口,三方应用不支持调用
。 |
| killed | boolean | 是 | 否 | 父进程给子进程发信号是否成功。
<br>
**系统接口:**
此接口为系统接口。
<br>
此接口仅用于对应用的测试
。 |
### wait
### wait
...
@@ -249,7 +250,9 @@ wait(): Promise<number>
...
@@ -249,7 +250,9 @@ wait(): Promise<number>
等待子进程运行结束,返回promise对象,其值为子进程的退出码。
等待子进程运行结束,返回promise对象,其值为子进程的退出码。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -276,7 +279,9 @@ getOutput(): Promise<Uint8Array>
...
@@ -276,7 +279,9 @@ getOutput(): Promise<Uint8Array>
获取子进程的标准输出。
获取子进程的标准输出。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -303,7 +308,9 @@ getErrorOutput(): Promise<Uint8Array>
...
@@ -303,7 +308,9 @@ getErrorOutput(): Promise<Uint8Array>
获取子进程的标准错误输出。
获取子进程的标准错误输出。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -330,7 +337,9 @@ close(): void
...
@@ -330,7 +337,9 @@ close(): void
关闭正在运行的子进程。
关闭正在运行的子进程。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -348,7 +357,9 @@ kill(signal: number | string): void
...
@@ -348,7 +357,9 @@ kill(signal: number | string): void
用于发送信号给子进程,结束指定进程。
用于发送信号给子进程,结束指定进程。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -592,7 +603,9 @@ runCmd(command: string, options?: { timeout?: number, killSignal?: number | stri
...
@@ -592,7 +603,9 @@ runCmd(command: string, options?: { timeout?: number, killSignal?: number | stri
通过runcmd可以fork一个新的进程来运行一段shell,并返回ChildProcess对象。
通过runcmd可以fork一个新的进程来运行一段shell,并返回ChildProcess对象。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -649,7 +662,9 @@ on(type: string, listener: EventListener): void
...
@@ -649,7 +662,9 @@ on(type: string, listener: EventListener): void
存储用户所触发的事件。
存储用户所触发的事件。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -681,7 +696,9 @@ off(type: string): boolean
...
@@ -681,7 +696,9 @@ off(type: string): boolean
删除用户存储的事件。
删除用户存储的事件。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -736,7 +753,9 @@ cwd(): string
...
@@ -736,7 +753,9 @@ cwd(): string
用该方法获取进程的工作目录。
用该方法获取进程的工作目录。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -753,7 +772,9 @@ chdir(dir: string): void
...
@@ -753,7 +772,9 @@ chdir(dir: string): void
更改进程的当前工作目录。
更改进程的当前工作目录。
该接口为系统接口,三方应用不支持调用。
**系统接口:**
此接口为系统接口。
此接口仅用于对应用的测试。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
...
zh-cn/application-dev/reference/apis/js-apis-url.md
浏览文件 @
3a1e4d85
# URL字符串解析
# URL字符串解析
>  **说明:**
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
## 导入模块
...
@@ -13,7 +14,7 @@ import Url from '@ohos.url'
...
@@ -13,7 +14,7 @@ import Url from '@ohos.url'
### constructor<sup>9+</sup>
### constructor<sup>9+</sup>
constructor(init?: string
[][]
| Record
<
string, string
>
| string | URLParams)
constructor(init?: string
[][]
| Record
<
string, string
>
| string | URL
Search
Params)
URLParams的构造函数。
URLParams的构造函数。
...
@@ -23,7 +24,7 @@ URLParams的构造函数。
...
@@ -23,7 +24,7 @@ URLParams的构造函数。
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| init | string
[][]
\|
Record
<
string, string
>
\|
string
\|
URL
Params | 否 | 入参对象。
<br/>
- string
[][]
:字符串二维数组
<br/>
- Record
<
string, string
>
:对象列表
<br/>
- string:字符串
<br/>
- URL
Params:对象 |
| init | string
[][]
\|
Record
<
string, string
>
\|
string
\|
URL
SearchParams | 否 | 入参对象。
<br/>
- string
[][]
:字符串二维数组
<br/>
- Record
<
string, string
>
:对象列表
<br/>
- string:字符串
<br/>
- URLSearch
Params:对象 |
**示例:**
**示例:**
...
@@ -139,7 +140,7 @@ for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pair
...
@@ -139,7 +140,7 @@ for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pair
### forEach<sup>9+</sup>
### forEach<sup>9+</sup>
forEach(callback
f
n: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void
forEach(callback
F
n: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void
通过回调函数来遍历URLSearchParams实例对象上的键值对。
通过回调函数来遍历URLSearchParams实例对象上的键值对。
...
@@ -149,10 +150,10 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
...
@@ -149,10 +150,10 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback
f
n | function | 是 | 回调函数。 |
| callback
F
n | function | 是 | 回调函数。 |
| thisArg | Object | 否 | callback
f
n被调用时用作this值 |
| thisArg | Object | 否 | callback
F
n被调用时用作this值 |
**表1**
callback
f
n的参数说明
**表1**
callback
F
n的参数说明
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -369,8 +370,9 @@ console.log(params.toString());
...
@@ -369,8 +370,9 @@ console.log(params.toString());
### constructor<sup>(deprecated)</sup>
### constructor<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>](#constructor9+)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>](#constructor9+)替代。
constructor(init?: string
[][]
| Record
<
string, string
>
| string | URLSearchParams)
constructor(init?: string
[][]
| Record
<
string, string
>
| string | URLSearchParams)
...
@@ -396,8 +398,9 @@ let params = new Url.URLSearchParams(urlObject.search);
...
@@ -396,8 +398,9 @@ let params = new Url.URLSearchParams(urlObject.search);
### append<sup>(deprecated)</sup>
### append<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.append<sup>9+</sup>](#append9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.append<sup>9+</sup>](#append9)替代。
append(name: string, value: string): void
append(name: string, value: string): void
...
@@ -422,8 +425,9 @@ paramsObject.append('fod', '3');
...
@@ -422,8 +425,9 @@ paramsObject.append('fod', '3');
### delete<sup>(deprecated)</sup>
### delete<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.delete<sup>9+</sup>](#delete9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.delete<sup>9+</sup>](#delete9)替代。
delete(name: string): void
delete(name: string): void
...
@@ -447,8 +451,9 @@ paramsobject.delete('fod');
...
@@ -447,8 +451,9 @@ paramsobject.delete('fod');
### getAll<sup>(deprecated)</sup>
### getAll<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.getAll<sup>9+</sup>](#getall9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.getAll<sup>9+</sup>](#getall9)替代。
getAll(name: string): string[]
getAll(name: string): string[]
...
@@ -479,8 +484,9 @@ console.log(params.getAll('fod').toString()) // Output ["1","3"].
...
@@ -479,8 +484,9 @@ console.log(params.getAll('fod').toString()) // Output ["1","3"].
### entries<sup>(deprecated)</sup>
### entries<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.entries<sup>9+</sup>](#entries9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.entries<sup>9+</sup>](#entries9)替代。
entries(): IterableIterator
<
[
string
,
string
]
>
entries(): IterableIterator
<
[
string
,
string
]
>
...
@@ -505,10 +511,11 @@ for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pair
...
@@ -505,10 +511,11 @@ for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pair
### forEach<sup>(deprecated)</sup>
### forEach<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.forEach<sup>9+</sup>](#foreach9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.forEach<sup>9+</sup>](#foreach9)替代。
forEach(callback
f
n: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void
forEach(callback
F
n: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void
通过回调函数来遍历URLSearchParams实例对象上的键值对。
通过回调函数来遍历URLSearchParams实例对象上的键值对。
...
@@ -518,10 +525,10 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
...
@@ -518,10 +525,10 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback
f
n | function | 是 | 回调函数。 |
| callback
F
n | function | 是 | 回调函数。 |
| thisArg | Object | 否 | callback
f
n被调用时用作this值 |
| thisArg | Object | 否 | callback
F
n被调用时用作this值 |
**表1**
callback
f
n的参数说明
**表1**
callback
F
n的参数说明
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -540,8 +547,9 @@ myURLObject.searchParams.forEach((value, name, searchParams) => {
...
@@ -540,8 +547,9 @@ myURLObject.searchParams.forEach((value, name, searchParams) => {
### get<sup>(deprecated)</sup>
### get<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.get<sup>9+</sup>](#get9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.get<sup>9+</sup>](#get9)替代。
get(name: string): string | null
get(name: string): string | null
...
@@ -572,8 +580,9 @@ let age = parseInt(paramsObject.get("age"), 10); // is the number 18
...
@@ -572,8 +580,9 @@ let age = parseInt(paramsObject.get("age"), 10); // is the number 18
### has<sup>(deprecated)</sup>
### has<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.has<sup>9+</sup>](#has9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.has<sup>9+</sup>](#has9)替代。
has(name: string): boolean
has(name: string): boolean
...
@@ -603,8 +612,9 @@ paramsObject.has('bard') === true;
...
@@ -603,8 +612,9 @@ paramsObject.has('bard') === true;
### set<sup>(deprecated)</sup>
### set<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.set<sup>9+</sup>](#set9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.set<sup>9+</sup>](#set9)替代。
set(name: string, value: string): void
set(name: string, value: string): void
...
@@ -629,8 +639,9 @@ paramsObject.set('baz', '3'); // Add a third parameter.
...
@@ -629,8 +639,9 @@ paramsObject.set('baz', '3'); // Add a third parameter.
### sort<sup>(deprecated)</sup>
### sort<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.sort<sup>9+</sup>](#sort9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.sort<sup>9+</sup>](#sort9)替代。
sort(): void
sort(): void
...
@@ -648,8 +659,9 @@ console.log(searchParamsObject.toString()); // Display the sorted query string /
...
@@ -648,8 +659,9 @@ console.log(searchParamsObject.toString()); // Display the sorted query string /
### keys<sup>(deprecated)</sup>
### keys<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.keys<sup>9+</sup>](#keys9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.keys<sup>9+</sup>](#keys9)替代。
keys(): IterableIterator
<
string
>
keys(): IterableIterator
<
string
>
...
@@ -674,8 +686,9 @@ for (var key of searchParamsObject .keys()) { // Output key-value pairs
...
@@ -674,8 +686,9 @@ for (var key of searchParamsObject .keys()) { // Output key-value pairs
### values<sup>(deprecated)</sup>
### values<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.values<sup>9+</sup>](#values9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.values<sup>9+</sup>](#values9)替代。
values(): IterableIterator
<
string
>
values(): IterableIterator
<
string
>
...
@@ -700,8 +713,9 @@ for (var value of searchParams.values()) {
...
@@ -700,8 +713,9 @@ for (var value of searchParams.values()) {
### [Symbol.iterator]<sup>(deprecated)</sup>
### [Symbol.iterator]<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.[Symbol.iterator]<sup>9+</sup>](#symbol.iterator9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.[Symbol.iterator]<sup>9+</sup>](#symbol.iterator9)替代。
[Symbol.iterator]
\(
): IterableIterator
<
[string, string]
>
[Symbol.iterator]
\(
): IterableIterator
<
[string, string]
>
...
@@ -725,8 +739,9 @@ for (const [name, value] of paramsObject) {
...
@@ -725,8 +739,9 @@ for (const [name, value] of paramsObject) {
```
```
### tostring<sup>(deprecated)</sup>
### tostring<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.tostring<sup>9+</sup>](#tostring9)替代。
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[URLParams<sup>9+</sup>.tostring<sup>9+</sup>](#tostring9)替代。
toString(): string
toString(): string
...
@@ -755,7 +770,7 @@ console.log(params.toString());
...
@@ -755,7 +770,7 @@ console.log(params.toString());
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 |
参数
类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| hash | string | 是 | 是 | 获取和设置URL的片段部分。 |
| hash | string | 是 | 是 | 获取和设置URL的片段部分。 |
| host | string | 是 | 是 | 获取和设置URL的主机部分。 |
| host | string | 是 | 是 | 获取和设置URL的主机部分。 |
...
@@ -771,10 +786,13 @@ console.log(params.toString());
...
@@ -771,10 +786,13 @@ console.log(params.toString());
| URLParams | URLParams | 是 | 否 | 获取URLParams表示URL查询参数的对象。 |
| URLParams | URLParams | 是 | 否 | 获取URLParams表示URL查询参数的对象。 |
| username | string | 是 | 是 | 获取和设置URL的用户名部分。 |
| username | string | 是 | 是 | 获取和设置URL的用户名部分。 |
### constructor<sup>(deprecated)</sup>
### constructor
> **说明:**
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[parseURL<sup>9+</sup>](#parseURL9)替代。
constructor(url
?
: string, base?: string | URL)
constructor(url: string, base?: string | URL)
URL的构造函数。
URL的构造函数。
...
@@ -806,7 +824,7 @@ new Url.URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/
...
@@ -806,7 +824,7 @@ new Url.URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/
### parseURL<sup>9+</sup>
### parseURL<sup>9+</sup>
static parseURL(
inputUrl : string, inputBase ?: string | URL)
static parseURL(
url : string, base?: string | URL): URL
URL静态成员函数。
URL静态成员函数。
...
@@ -816,8 +834,8 @@ URL静态成员函数。
...
@@ -816,8 +834,8 @@ URL静态成员函数。
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
|
inputU
rl | string | 是 | 入参对象。 |
|
u
rl | string | 是 | 入参对象。 |
|
inputB
ase | string
\|
URL | 否 | 入参字符串或者对象。
<br/>
- string:字符串
<br/>
- URL:字符串或对象 |
|
b
ase | string
\|
URL | 否 | 入参字符串或者对象。
<br/>
- string:字符串
<br/>
- URL:字符串或对象 |
**示例:**
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-util.md
浏览文件 @
3a1e4d85
# util工具函数
# util工具函数
该模块主要提供常用的工具函数,实现字符串编解码(TextEncoder,TextDecoder)、有理数运算(RationalNumber)、缓冲区管理(LruBuffer)、范围判断(Scope)、Base64编解码(Base64)、内置对象类型检查(Types)等功能。
>  **说明:**
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
该模块主要提供常用的工具函数,实现字符串编解码(TextEncoder,TextDecoder)、有理数运算(RationalNumber)、缓冲区管理(LruBuffer)、范围判断(Scope)、Base64编解码(Base64)、内置对象类型检查(Types)等功能。
## 导入模块
## 导入模块
```
```
js
import
util
from
'
@ohos.util
'
;
import
util
from
'
@ohos.util
'
;
```
```
...
@@ -44,13 +43,14 @@ console.log(res);
...
@@ -44,13 +43,14 @@ console.log(res);
## util.printf<sup>(deprecated)</sup>
## util.printf<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[util.format9+](#utilformat9)替代。
printf(format: string, ...args: Object[]): string
printf(format: string, ...args: Object[]): string
通过式样化字符串对输入的内容按特定格式输出。
通过式样化字符串对输入的内容按特定格式输出。
> **说明:**
>
> 从API Version 7开始支持,从API Version 9开始废弃,建议使用[util.format<sup>9+</sup>](#utilformat9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -67,6 +67,7 @@ printf(format: string, ...args: Object[]): string
...
@@ -67,6 +67,7 @@ printf(format: string, ...args: Object[]): string
| string | 按特定格式式样化后的字符串。 |
| string | 按特定格式式样化后的字符串。 |
**示例:**
**示例:**
```
js
```
js
let
res
=
util
.
printf
(
"
%s
"
,
"
hello world!
"
);
let
res
=
util
.
printf
(
"
%s
"
,
"
hello world!
"
);
console
.
log
(
res
);
console
.
log
(
res
);
...
@@ -94,21 +95,22 @@ errnoToString(errno: number): string
...
@@ -94,21 +95,22 @@ errnoToString(errno: number): string
**示例:**
**示例:**
```
js
```
js
let
errnum
=
10
;
// 10 : a system error number
let
errnum
=
10
;
// 10 : a system error number
let
result
=
util
.
errnoToString
(
errnum
);
let
result
=
util
.
errnoToString
(
errnum
);
console
.
log
(
"
result =
"
+
result
);
console
.
log
(
"
result =
"
+
result
);
```
```
## util.getErrorString<sup>(deprecated)</sup>
## util.getErrorString<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[util.errnoToString9+](#utilerrnotostring9)替代。
getErrorString(errno: number): string
getErrorString(errno: number): string
获取系统错误码对应的详细信息。
获取系统错误码对应的详细信息。
> **说明:**
>
> 从API Version 7开始支持,从API Version 9开始废弃,建议使用[util.errnoToString<sup>9+</sup>](#utilerrnotostring9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -124,6 +126,7 @@ getErrorString(errno: number): string
...
@@ -124,6 +126,7 @@ getErrorString(errno: number): string
| string | 错误码对应的详细信息。 |
| string | 错误码对应的详细信息。 |
**示例:**
**示例:**
```
js
```
js
let
errnum
=
10
;
// 10 : a system error number
let
errnum
=
10
;
// 10 : a system error number
let
result
=
util
.
getErrorString
(
errnum
);
let
result
=
util
.
getErrorString
(
errnum
);
...
@@ -151,6 +154,7 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void
...
@@ -151,6 +154,7 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void
| Function | 返回一个第一个参数是拒绝原因(如果
Promise
已解决,则为
null),第二个参数是已解决的回调函数。 |
| Function | 返回一个第一个参数是拒绝原因(如果
Promise
已解决,则为
null),第二个参数是已解决的回调函数。 |
**示例:**
**示例:**
```
js
```
js
async
function
promiseFn
()
{
async
function
promiseFn
()
{
return
Promise
.
reject
(
'
value
'
);
return
Promise
.
reject
(
'
value
'
);
...
@@ -184,6 +188,7 @@ promisify(original: (err: Object, value: Object) => void): Function
...
@@ -184,6 +188,7 @@ promisify(original: (err: Object, value: Object) => void): Function
| Function | 采用遵循常见的错误优先的回调风格的函数(也就是将
(err,
value)
=
>
...
回调作为最后一个参数),并返回一个返回
promise
的函数。 |
| Function | 采用遵循常见的错误优先的回调风格的函数(也就是将
(err,
value)
=
>
...
回调作为最后一个参数),并返回一个返回
promise
的函数。 |
**示例:**
**示例:**
```
js
```
js
function
aysnFun
(
str1
,
str2
)
{
function
aysnFun
(
str1
,
str2
)
{
if
(
typeof
str1
===
'
object
'
&&
typeof
str2
===
'
object
'
)
{
if
(
typeof
str1
===
'
object
'
&&
typeof
str2
===
'
object
'
)
{
...
@@ -202,11 +207,12 @@ promisify(original: (err: Object, value: Object) => void): Function
...
@@ -202,11 +207,12 @@ promisify(original: (err: Object, value: Object) => void): Function
promiseWrapper(original: (err: Object, value: Object) =
>
void): Object
promiseWrapper(original: (err: Object, value: Object) =
>
void): Object
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[util.promisify9+](#utilpromisify9)替代。
对异步函数处理并返回一个promise的版本。
对异步函数处理并返回一个promise的版本。
> **说明:**
>
> 此接口不可用,建议使用[util.promisify<sup>9+</sup>](#utilpromisify9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -242,6 +248,7 @@ randomUUID(entropyCache?: boolean): string
...
@@ -242,6 +248,7 @@ randomUUID(entropyCache?: boolean): string
| string | 表示此UUID的字符串。 |
| string | 表示此UUID的字符串。 |
**示例:**
**示例:**
```
js
```
js
let
uuid
=
util
.
randomUUID
(
true
);
let
uuid
=
util
.
randomUUID
(
true
);
console
.
log
(
"
RFC 4122 Version 4 UUID:
"
+
uuid
);
console
.
log
(
"
RFC 4122 Version 4 UUID:
"
+
uuid
);
...
@@ -270,6 +277,7 @@ randomBinaryUUID(entropyCache?: boolean): Uint8Array
...
@@ -270,6 +277,7 @@ randomBinaryUUID(entropyCache?: boolean): Uint8Array
| Uint8Array | 表示此UUID的Uint8Array值。 |
| Uint8Array | 表示此UUID的Uint8Array值。 |
**示例:**
**示例:**
```
js
```
js
let
uuid
=
util
.
randomBinaryUUID
(
true
);
let
uuid
=
util
.
randomBinaryUUID
(
true
);
console
.
log
(
JSON
.
stringify
(
uuid
));
console
.
log
(
JSON
.
stringify
(
uuid
));
...
@@ -298,6 +306,7 @@ parseUUID(uuid: string): Uint8Array
...
@@ -298,6 +306,7 @@ parseUUID(uuid: string): Uint8Array
| Uint8Array | 返回表示此UUID的Uint8Array,如果解析失败,则抛出SyntaxError。 |
| Uint8Array | 返回表示此UUID的Uint8Array,如果解析失败,则抛出SyntaxError。 |
**示例:**
**示例:**
```
js
```
js
let
uuid
=
util
.
parseUUID
(
"
84bdf796-66cc-4655-9b89-d6218d100f9c
"
);
let
uuid
=
util
.
parseUUID
(
"
84bdf796-66cc-4655-9b89-d6218d100f9c
"
);
console
.
log
(
JSON
.
stringify
(
uuid
));
console
.
log
(
JSON
.
stringify
(
uuid
));
...
@@ -311,7 +320,7 @@ parseUUID(uuid: string): Uint8Array
...
@@ -311,7 +320,7 @@ parseUUID(uuid: string): Uint8Array
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang。
| 名称 |
参数
类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| encoding | string | 是 | 否 | 编码格式。
<br/>
-
支持格式:utf-8、ibm866、iso-8859-2、iso-8859-3、iso-8859-4、iso-8859-5、iso-8859-6、iso-8859-7、iso-8859-8、iso-8859-8-i、iso-8859-10、iso-8859-13、iso-8859-14、iso-8859-15、koi8-r、koi8-u、macintosh、windows-874、windows-1250、windows-1251、windows-1252、windows-1253、windows-1254、windows-1255、windows-1256、windows-1257、windows-1258、x-mac-cyrilli、gbk、gb18030、big5、euc-jp、iso-2022-jp、shift_jis、euc-kr、utf-16be、utf-16le。 |
| encoding | string | 是 | 否 | 编码格式。
<br/>
-
支持格式:utf-8、ibm866、iso-8859-2、iso-8859-3、iso-8859-4、iso-8859-5、iso-8859-6、iso-8859-7、iso-8859-8、iso-8859-8-i、iso-8859-10、iso-8859-13、iso-8859-14、iso-8859-15、koi8-r、koi8-u、macintosh、windows-874、windows-1250、windows-1251、windows-1252、windows-1253、windows-1254、windows-1255、windows-1256、windows-1257、windows-1258、x-mac-cyrilli、gbk、gb18030、big5、euc-jp、iso-2022-jp、shift_jis、euc-kr、utf-16be、utf-16le。 |
| fatal | boolean | 是 | 否 | 是否显示致命错误。 |
| fatal | boolean | 是 | 否 | 是否显示致命错误。 |
...
@@ -331,6 +340,8 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
...
@@ -331,6 +340,8 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
替代有参构造功能。
替代有参构造功能。
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
...
@@ -338,7 +349,7 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
...
@@ -338,7 +349,7 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
| encoding | string | 否 | 编码格式。 |
| encoding | string | 否 | 编码格式。 |
| options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 |
| options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 |
**表1.1**
options
**表1.1**
options
| 名称 | 参数类型 | 必填 | 说明 |
| 名称 | 参数类型 | 必填 | 说明 |
| --------- | -------- | ---- | ------------------ |
| --------- | -------- | ---- | ------------------ |
...
@@ -347,20 +358,21 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
...
@@ -347,20 +358,21 @@ create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean },): T
**示例:**
**示例:**
```
js
```
js
let
textDecoder
=
new
util
.
TextDecoder
()
let
textDecoder
=
new
util
.
TextDecoder
()
textDecoder
.
create
(
'
utf-8
'
,
{
ignoreBOM
:
true
});
textDecoder
.
create
(
'
utf-8
'
,
{
ignoreBOM
:
true
});
```
```
### constructor<sup>(deprecated)</sup>
### constructor<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[constructor9+](#constructor9)替代。
constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean },)
constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean },)
TextDecoder的构造函数。
TextDecoder的构造函数。
> **说明:**
>
> 从API Version 7开始支持,从API Version 9开始废弃,建议使用[constructor<sup>9+</sup>](#constructor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -378,6 +390,7 @@ TextDecoder的构造函数。
...
@@ -378,6 +390,7 @@ TextDecoder的构造函数。
| ignoreBOM | boolean | 否 | 是否忽略BOM标记。 |
| ignoreBOM | boolean | 否 | 是否忽略BOM标记。 |
**示例:**
**示例:**
```
js
```
js
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
```
```
...
@@ -397,7 +410,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
...
@@ -397,7 +410,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
| input | Uint8Array | 是 | 符合格式需要解码的数组。 |
| input | Uint8Array | 是 | 符合格式需要解码的数组。 |
| options | Object | 否 | 解码相关选项参数。 |
| options | Object | 否 | 解码相关选项参数。 |
**表2**
options
**表2**
options
| 名称 | 参数类型 | 必填 | 说明 |
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -410,6 +423,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
...
@@ -410,6 +423,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
| string | 解码后的数据。 |
| string | 解码后的数据。 |
**示例:**
**示例:**
```
js
```
js
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
result
=
new
Uint8Array
(
6
);
let
result
=
new
Uint8Array
(
6
);
...
@@ -440,7 +454,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
...
@@ -440,7 +454,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
| input | Uint8Array | 是 | 符合格式需要解码的数组。 |
| input | Uint8Array | 是 | 符合格式需要解码的数组。 |
| options | Object | 否 | 解码相关选项参数。 |
| options | Object | 否 | 解码相关选项参数。 |
**表2**
options
**表2**
options
| 名称 | 参数类型 | 必填 | 说明 |
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -453,6 +467,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
...
@@ -453,6 +467,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
| string | 解码后的数据。 |
| string | 解码后的数据。 |
**示例:**
**示例:**
```
js
```
js
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
result
=
new
Uint8Array
(
6
);
let
result
=
new
Uint8Array
(
6
);
...
@@ -474,7 +489,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
...
@@ -474,7 +489,7 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Utils.Lang。
| 名称 |
参数
类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- | -------- |
| encoding | string | 是 | 否 | 编码格式,默认值是utf-8。 |
| encoding | string | 是 | 否 | 编码格式,默认值是utf-8。 |
...
@@ -488,6 +503,7 @@ TextEncoder的构造函数。
...
@@ -488,6 +503,7 @@ TextEncoder的构造函数。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**示例:**
**示例:**
```
js
```
js
let
textEncoder
=
new
util
.
TextEncoder
();
let
textEncoder
=
new
util
.
TextEncoder
();
```
```
...
@@ -504,7 +520,7 @@ encodeInto(input?: string): Uint8Array
...
@@ -504,7 +520,7 @@ encodeInto(input?: string): Uint8Array
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------ |
| ------ | ------ | ---- | ------------------ |
| input | string |
是
| 需要编码的字符串。 |
| input | string |
否
| 需要编码的字符串。 |
**返回值:**
**返回值:**
...
@@ -523,20 +539,21 @@ result = textEncoder.encodeInto("\uD800¥¥");
...
@@ -523,20 +539,21 @@ result = textEncoder.encodeInto("\uD800¥¥");
### encode<sup>(deprecated)</sup>
### encode<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encodeInto9+](#encodeinto9)替代。
encode(input?: string): Uint8Array
encode(input?: string): Uint8Array
通过输入参数编码后输出对应文本。
通过输入参数编码后输出对应文本。
> **说明:**
>
> 从API Version 7开始支持,从API Version 9开始废弃,建议使用[encodeInto<sup>9+</sup>](#encodeinto9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| input | string |
是
| 需要编码的字符串。 |
| input | string |
否
| 需要编码的字符串。 |
**返回值:**
**返回值:**
...
@@ -585,13 +602,14 @@ result = that.encodeInto('abcd', dest)
...
@@ -585,13 +602,14 @@ result = that.encodeInto('abcd', dest)
### encodeInto<sup>(deprecated)</sup>
### encodeInto<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encodeIntoUint8Array9+](#encodeintouint8array9)替代。
encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
放置生成的UTF-8编码文本。
放置生成的UTF-8编码文本。
> **说明:**
>
> 从API Version 7开始支持,从API Version 9开始废弃,建议使用[encodeIntoUint8Array<sup>9+</sup>](#encodeintouint8array9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -628,13 +646,13 @@ RationalNumber的构造函数。
...
@@ -628,13 +646,13 @@ RationalNumber的构造函数。
**示例:**
**示例:**
```
js
```
js
let
rationalNumber
=
new
util
.
RationalNumber
();
let
rationalNumber
=
new
util
.
RationalNumber
();
```
```
### parseRationalNumber<sup>9+</sup>
### parseRationalNumber<sup>9+</sup>
parseRationalNumber(numerator: number,denominator: number)
parseRationalNumber(numerator: number,denominator: number)
: RationalNumber
替代原有参构造的参数处理。
替代原有参构造的参数处理。
...
@@ -649,20 +667,21 @@ parseRationalNumber(numerator: number,denominator: number)
...
@@ -649,20 +667,21 @@ parseRationalNumber(numerator: number,denominator: number)
**示例:**
**示例:**
```
js
```
js
let
rationalNumber
=
new
util
.
RationalNumber
();
let
rationalNumber
=
new
util
.
RationalNumber
();
rationalNumber
.
parseRationalNumber
(
1
,
2
)
rationalNumber
.
parseRationalNumber
(
1
,
2
)
```
```
### constructor<sup>8+(deprecated)</sup>
> **说明:**<br/>
### constructor<sup>(deprecated)</sup>
> 从API Version 9开始废弃,建议使用[constructor9+](#constructor9)替代。
constructor(numerator: number,denominator: number)
constructor(numerator: number,denominator: number)
RationalNumber的构造函数。
RationalNumber的构造函数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[constructor<sup>9+</sup>](#constructor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -674,9 +693,9 @@ RationalNumber的构造函数。
...
@@ -674,9 +693,9 @@ RationalNumber的构造函数。
**示例:**
**示例:**
```
js
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
```
### createRationalFromString<sup>8+</sup>
### createRationalFromString<sup>8+</sup>
...
@@ -699,10 +718,11 @@ static createRationalFromString(rationalString: string): RationalNumber
...
@@ -699,10 +718,11 @@ static createRationalFromString(rationalString: string): RationalNumber
| object | 返回有理数类的对象。 |
| object | 返回有理数类的对象。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
```
### compare<sup>9+</sup>
### compare<sup>9+</sup>
...
@@ -732,15 +752,16 @@ let rational = util.RationalNumber.createRationalFromString("3/4");
...
@@ -732,15 +752,16 @@ let rational = util.RationalNumber.createRationalFromString("3/4");
let
result
=
rationalNumber
.
compare
(
rational
);
let
result
=
rationalNumber
.
compare
(
rational
);
```
```
### compareTo<sup>8+</sup><sup>(deprecated)</sup>
### compareTo<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[compare9+](#compare9)替代。
compareTo(another: RationalNumber): number
compareTo(another: RationalNumber): number
将当前的RationalNumber对象与给定的对象进行比较。
将当前的RationalNumber对象与给定的对象进行比较。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[compare<sup>9+</sup>](#compare9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -756,11 +777,12 @@ compareTo(another: RationalNumber): number
...
@@ -756,11 +777,12 @@ compareTo(another: RationalNumber): number
| number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 |
| number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
let
result
=
rationalNumber
.
compareTo
(
rational
);
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
```
let
result
=
rationalNumber
.
compareTo
(
rational
);
```
### valueOf<sup>8+</sup>
### valueOf<sup>8+</sup>
...
@@ -777,10 +799,11 @@ valueOf(): number
...
@@ -777,10 +799,11 @@ valueOf(): number
| number | 返回整数或者浮点数的值。 |
| number | 返回整数或者浮点数的值。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
valueOf
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
valueOf
();
```
### equals<sup>8+</sup>
### equals<sup>8+</sup>
...
@@ -803,11 +826,12 @@ equals(obj: Object): boolean
...
@@ -803,11 +826,12 @@ equals(obj: Object): boolean
| boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 |
| boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
let
result
=
rationalNumber
.
equals
(
rational
);
let
rational
=
util
.
RationalNumber
.
createRationalFromString
(
"
3/4
"
);
```
let
result
=
rationalNumber
.
equals
(
rational
);
```
### getCommonFactor<sup>9+</sup>
### getCommonFactor<sup>9+</sup>
...
@@ -832,19 +856,21 @@ getCommonFactor(number1: number,number2: number): number
...
@@ -832,19 +856,21 @@ getCommonFactor(number1: number,number2: number): number
**示例:**
**示例:**
```
js
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
let
result
=
util
.
RationalNumber
.
getCommonFactor
(
4
,
6
);
let
result
=
util
.
RationalNumber
.
getCommonFactor
(
4
,
6
);
```
```
### getCommonDivisor<sup>8+(deprecated)</sup>
### getCommonDivisor<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getCommonFactor9+](#getcommonfactor9)替代。
static getCommonDivisor(number1: number,number2: number): number
static getCommonDivisor(number1: number,number2: number): number
获取两个指定整数的最大公约数。
获取两个指定整数的最大公约数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getCommonFactor<sup>9+</sup>](#getcommonfactor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -861,10 +887,11 @@ static getCommonDivisor(number1: number,number2: number): number
...
@@ -861,10 +887,11 @@ static getCommonDivisor(number1: number,number2: number): number
| number | 返回两个给定数字的最大公约数。 |
| number | 返回两个给定数字的最大公约数。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
util
.
RationalNumber
.
getCommonDivisor
(
4
,
6
);
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
util
.
RationalNumber
.
getCommonDivisor
(
4
,
6
);
```
### getNumerator<sup>8+</sup>
### getNumerator<sup>8+</sup>
...
@@ -881,10 +908,11 @@ getNumerator(): number
...
@@ -881,10 +908,11 @@ getNumerator(): number
| number | 返回RationalNumber对象的分子的值。 |
| number | 返回RationalNumber对象的分子的值。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
getNumerator
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
getNumerator
();
```
### getDenominator<sup>8+</sup>
### getDenominator<sup>8+</sup>
...
@@ -901,10 +929,11 @@ getDenominator(): number
...
@@ -901,10 +929,11 @@ getDenominator(): number
| number | 返回RationalNumber对象的分母的值。 |
| number | 返回RationalNumber对象的分母的值。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
getDenominator
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
lett
result
=
rationalNumber
.
getDenominator
();
```
### isZero<sup>8+</sup>
### isZero<sup>8+</sup>
...
@@ -921,10 +950,11 @@ isZero():boolean
...
@@ -921,10 +950,11 @@ isZero():boolean
| boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 |
| boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
isZero
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
isZero
();
```
### isNaN<sup>8+</sup>
### isNaN<sup>8+</sup>
...
@@ -941,10 +971,11 @@ isNaN(): boolean
...
@@ -941,10 +971,11 @@ isNaN(): boolean
| boolean | 如果分母和分子都为0,则返回true;否则返回false。 |
| boolean | 如果分母和分子都为0,则返回true;否则返回false。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
isNaN
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
isNaN
();
```
### isFinite<sup>8+</sup>
### isFinite<sup>8+</sup>
...
@@ -961,10 +992,11 @@ isFinite():boolean
...
@@ -961,10 +992,11 @@ isFinite():boolean
| boolean | 如果分母不为0,则返回true;否则返回false。 |
| boolean | 如果分母不为0,则返回true;否则返回false。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
isFinite
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
isFinite
();
```
### toString<sup>8+</sup>
### toString<sup>8+</sup>
...
@@ -981,10 +1013,11 @@ toString(): string
...
@@ -981,10 +1013,11 @@ toString(): string
| string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 |
| string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 |
**示例:**
**示例:**
```
js
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
js
let
result
=
rationalNumber
.
toString
();
let
rationalNumber
=
new
util
.
RationalNumber
(
1
,
2
);
```
let
result
=
rationalNumber
.
toString
();
```
## LRUCache<sup>9+</sup>
## LRUCache<sup>9+</sup>
...
@@ -999,12 +1032,12 @@ toString(): string
...
@@ -999,12 +1032,12 @@ toString(): string
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LRUCache
();
let
pro
=
new
util
.
LRUCache
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
pro
.
put
(
1
,
8
);
pro
.
put
(
1
,
8
);
let
result
=
pro
.
length
;
let
result
=
pro
.
length
;
```
```
### constructor<sup>9+</sup>
### constructor<sup>9+</sup>
...
@@ -1022,9 +1055,9 @@ constructor(capacity?: number)
...
@@ -1022,9 +1055,9 @@ constructor(capacity?: number)
**示例:**
**示例:**
```
js
```
js
let
lrubuffer
=
new
util
.
LRUCache
();
let
lrubuffer
=
new
util
.
LRUCache
();
```
```
### updateCapacity<sup>9+</sup>
### updateCapacity<sup>9+</sup>
...
@@ -1043,10 +1076,10 @@ updateCapacity(newCapacity: number): void
...
@@ -1043,10 +1076,10 @@ updateCapacity(newCapacity: number): void
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LRUCache
();
let
pro
=
new
util
.
LRUCache
();
let
result
=
pro
.
updateCapacity
(
100
);
let
result
=
pro
.
updateCapacity
(
100
);
```
```
### toString<sup>9+</sup>
### toString<sup>9+</sup>
...
@@ -1065,13 +1098,13 @@ toString(): string
...
@@ -1065,13 +1098,13 @@ toString(): string
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LRUCache
();
let
pro
=
new
util
.
LRUCache
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
pro
.
get
(
2
);
pro
.
get
(
2
);
pro
.
remove
(
20
);
pro
.
remove
(
20
);
let
result
=
pro
.
toString
();
let
result
=
pro
.
toString
();
```
```
### getCapacity<sup>9+</sup>
### getCapacity<sup>9+</sup>
...
@@ -1274,7 +1307,7 @@ get(key: K): V | undefined
...
@@ -1274,7 +1307,7 @@ get(key: K): V | undefined
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------ | ------------------------------------------------------------ |
| ------------------------ | ------------------------------------------------------------ |
| V
\|
undefined | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
| V
\|
undefined | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
**示例:**
**示例:**
...
@@ -1402,10 +1435,10 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
...
@@ -1402,10 +1435,10 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------- | ---- | ------------------------------------------------------------ |
| -------- | ------- | ---- | ------------------------------------------------------------ |
| isEvict | boolean |
否
| 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| isEvict | boolean |
是
| 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| key | K | 是 | 表示删除的键。 |
| key | K | 是 | 表示删除的键。 |
| value | V | 是 | 表示删除的值。 |
| value | V | 是 | 表示删除的值。 |
| newValue | V |
否
| 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
| newValue | V |
是
| 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
**示例:**
**示例:**
...
@@ -1432,7 +1465,7 @@ lru.afterRemoval(false,10,30,null);
...
@@ -1432,7 +1465,7 @@ lru.afterRemoval(false,10,30,null);
### contains<sup>9+</sup>
### contains<sup>9+</sup>
contains(key:
K
): boolean
contains(key:
object
): boolean
检查当前缓冲区是否包含指定的键。
检查当前缓冲区是否包含指定的键。
...
@@ -1440,9 +1473,9 @@ contains(key: K): boolean
...
@@ -1440,9 +1473,9 @@ contains(key: K): boolean
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型
| 必填 | 说明 |
| ------ | ---- | ---- | ---------------- |
| ------ | ----
--
| ---- | ---------------- |
| key |
K
| 是 | 表示要检查的键。 |
| key |
object
| 是 | 表示要检查的键。 |
**返回值:**
**返回值:**
...
@@ -1531,10 +1564,11 @@ pro.put(2,10);
...
@@ -1531,10 +1564,11 @@ pro.put(2,10);
let
result
=
pro
[
Symbol
.
iterator
]();
let
result
=
pro
[
Symbol
.
iterator
]();
```
```
## LruBuffer<sup>
8+
(deprecated)</sup>
## LruBuffer<sup>(deprecated)</sup>
> **说明:**<br/>
> **说明:**
> 从API Version 9开始废弃,建议使用[LRUCache9+](#lrucache9)替代。
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[LRUCache<sup>9+</sup>](#lrucache9)替代。
### 属性
### 属性
...
@@ -1545,6 +1579,7 @@ let result = pro[Symbol.iterator]();
...
@@ -1545,6 +1579,7 @@ let result = pro[Symbol.iterator]();
| length | number | 是 | 否 | 当前缓冲区中值的总数。 |
| length | number | 是 | 否 | 当前缓冲区中值的总数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1552,15 +1587,16 @@ let result = pro[Symbol.iterator]();
...
@@ -1552,15 +1587,16 @@ let result = pro[Symbol.iterator]();
let
result
=
pro
.
length
;
let
result
=
pro
.
length
;
```
```
### constructor<sup>8+(deprecated)</sup>
### constructor<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[constructor9+](#constructor9)替代。
constructor(capacity?: number)
constructor(capacity?: number)
默认构造函数用于创建一个新的LruBuffer实例,默认容量为64。
默认构造函数用于创建一个新的LruBuffer实例,默认容量为64。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[constructor<sup>9+</sup>](#constructor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -1570,19 +1606,21 @@ constructor(capacity?: number)
...
@@ -1570,19 +1606,21 @@ constructor(capacity?: number)
| capacity | number | 否 | 指示要为缓冲区自定义的容量。 |
| capacity | number | 否 | 指示要为缓冲区自定义的容量。 |
**示例:**
**示例:**
```
js
```
js
let
lrubuffer
=
new
util
.
LruBuffer
();
let
lrubuffer
=
new
util
.
LruBuffer
();
```
```
### updateCapacity<sup>8+(deprecated)</sup>
### updateCapacity<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[updateCapacity9+](#updatecapacity9)替代。
updateCapacity(newCapacity: number): void
updateCapacity(newCapacity: number): void
将缓冲区容量更新为指定容量,如果newCapacity小于或等于0,则抛出异常。
将缓冲区容量更新为指定容量,如果newCapacity小于或等于0,则抛出异常。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[updateCapacity<sup>9+</sup>](#updatecapacity9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -1592,20 +1630,22 @@ updateCapacity(newCapacity: number): void
...
@@ -1592,20 +1630,22 @@ updateCapacity(newCapacity: number): void
| newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 |
| newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
let
result
=
pro
.
updateCapacity
(
100
);
let
result
=
pro
.
updateCapacity
(
100
);
```
```
### toString<sup>8+(deprecated)</sup>
### toString<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[toString9+](#tostring9)替代。
toString(): string
toString(): string
返回对象的字符串表示形式。
返回对象的字符串表示形式。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[toString<sup>9+</sup>](#tostring9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1615,6 +1655,7 @@ toString(): string
...
@@ -1615,6 +1655,7 @@ toString(): string
| string | 返回对象的字符串表示形式。 |
| string | 返回对象的字符串表示形式。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1623,15 +1664,16 @@ toString(): string
...
@@ -1623,15 +1664,16 @@ toString(): string
let
result
=
pro
.
toString
();
let
result
=
pro
.
toString
();
```
```
### getCapacity<sup>8+(deprecated)</sup>
### getCapacity<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getCapacity9+](#getcapacity9)替代。
getCapacity(): number
getCapacity(): number
获取当前缓冲区的容量。
获取当前缓冲区的容量。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getCapacity<sup>9+</sup>](#getcapacity9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1646,18 +1688,20 @@ getCapacity(): number
...
@@ -1646,18 +1688,20 @@ getCapacity(): number
let
result
=
pro
.
getCapacity
();
let
result
=
pro
.
getCapacity
();
```
```
### clear<sup>8+(deprecated)</sup>
### clear<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[clear9+](#clear9)替代。
clear(): void
clear(): void
从当前缓冲区清除键值对。后续会调用afterRemoval()方法执行后续操作。
从当前缓冲区清除键值对。后续会调用afterRemoval()方法执行后续操作。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[clear<sup>9+</sup>](#clear9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1665,15 +1709,16 @@ clear(): void
...
@@ -1665,15 +1709,16 @@ clear(): void
pro
.
clear
();
pro
.
clear
();
```
```
### getCreateCount<sup>8+(deprecated)</sup>
### getCreateCount<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getCreateCount9+](#getcreatecount9)替代。
getCreateCount(): number
getCreateCount(): number
获取createDefault()返回值的次数。
获取createDefault()返回值的次数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getCreateCount<sup>9+</sup>](#getcreatecount9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1683,21 +1728,23 @@ getCreateCount(): number
...
@@ -1683,21 +1728,23 @@ getCreateCount(): number
| number | 返回createDefault()返回值的次数。 |
| number | 返回createDefault()返回值的次数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
1
,
8
);
pro
.
put
(
1
,
8
);
let
result
=
pro
.
getCreateCount
();
let
result
=
pro
.
getCreateCount
();
```
```
### getMissCount<sup>8+(deprecated)</sup>
### getMissCount<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getMissCount9+](#getmisscount9)替代。
getMissCount(): number
getMissCount(): number
获取查询值不匹配的次数。
获取查询值不匹配的次数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getMissCount<sup>9+</sup>](#getmisscount9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1707,6 +1754,7 @@ getMissCount(): number
...
@@ -1707,6 +1754,7 @@ getMissCount(): number
| number | 返回查询值不匹配的次数。 |
| number | 返回查询值不匹配的次数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1714,15 +1762,16 @@ getMissCount(): number
...
@@ -1714,15 +1762,16 @@ getMissCount(): number
let
result
=
pro
.
getMissCount
();
let
result
=
pro
.
getMissCount
();
```
```
### getRemovalCount<sup>8+(deprecated)</sup>
### getRemovalCount<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getRemovalCount9+](#getremovalcount9)替代。
getRemovalCount(): number
getRemovalCount(): number
获取从缓冲区中逐出值的次数。
获取从缓冲区中逐出值的次数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getRemovalCount<sup>9+</sup>](#getremovalcount9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1732,6 +1781,7 @@ getRemovalCount(): number
...
@@ -1732,6 +1781,7 @@ getRemovalCount(): number
| number | 返回从缓冲区中驱逐的次数。 |
| number | 返回从缓冲区中驱逐的次数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1740,15 +1790,16 @@ getRemovalCount(): number
...
@@ -1740,15 +1790,16 @@ getRemovalCount(): number
let
result
=
pro
.
getRemovalCount
();
let
result
=
pro
.
getRemovalCount
();
```
```
### getMatchCount<sup>8+(deprecated)</sup>
### getMatchCount<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getMatchCount9+](#getmatchcount9)替代。
getMatchCount(): number
getMatchCount(): number
获取查询值匹配成功的次数。
获取查询值匹配成功的次数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getMatchCount<sup>9+</sup>](#getmatchcount9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1758,6 +1809,7 @@ getMatchCount(): number
...
@@ -1758,6 +1809,7 @@ getMatchCount(): number
| number | 返回查询值匹配成功的次数。 |
| number | 返回查询值匹配成功的次数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1765,15 +1817,16 @@ getMatchCount(): number
...
@@ -1765,15 +1817,16 @@ getMatchCount(): number
let
result
=
pro
.
getMatchCount
();
let
result
=
pro
.
getMatchCount
();
```
```
### getPutCount<sup>8+(deprecated)</sup>
### getPutCount<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getPutCount9+](#getputcount9)替代。
getPutCount(): number
getPutCount(): number
获取将值添加到缓冲区的次数。
获取将值添加到缓冲区的次数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getPutCount<sup>9+</sup>](#getputcount9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1783,21 +1836,23 @@ getPutCount(): number
...
@@ -1783,21 +1836,23 @@ getPutCount(): number
| number | 返回将值添加到缓冲区的次数。 |
| number | 返回将值添加到缓冲区的次数。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
let
result
=
pro
.
getPutCount
();
let
result
=
pro
.
getPutCount
();
```
```
### isEmpty<sup>8+(deprecated)</sup>
### isEmpty<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[isEmpty9+](#isempty9)替代。
isEmpty(): boolean
isEmpty(): boolean
检查当前缓冲区是否为空。
检查当前缓冲区是否为空。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[isEmpty<sup>9+</sup>](#isempty9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1807,21 +1862,23 @@ isEmpty(): boolean
...
@@ -1807,21 +1862,23 @@ isEmpty(): boolean
| boolean | 如果当前缓冲区不包含任何值,则返回true。 |
| boolean | 如果当前缓冲区不包含任何值,则返回true。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
let
result
=
pro
.
isEmpty
();
let
result
=
pro
.
isEmpty
();
```
```
### get<sup>8+(deprecated)</sup>
### get<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[get9+](#get9)替代。
get(key: K): V | undefined
get(key: K): V | undefined
表示要查询的键。
表示要查询的键。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[get<sup>9+</sup>](#get9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -1837,21 +1894,23 @@ get(key: K): V | undefined
...
@@ -1837,21 +1894,23 @@ get(key: K): V | undefined
| V
\|
undefined | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
| V
\|
undefined | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
let
result
=
pro
.
get
(
2
);
let
result
=
pro
.
get
(
2
);
```
```
### put<sup>8+(deprecated)</sup>
### put<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[put9+](#put9)替代。
put(key: K,value: V): V
put(key: K,value: V): V
将键值对添加到缓冲区。
将键值对添加到缓冲区。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[put<sup>9+</sup>](#put9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -1868,19 +1927,21 @@ put(key: K,value: V): V
...
@@ -1868,19 +1927,21 @@ put(key: K,value: V): V
| V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 |
| V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
let
result
=
pro
.
put
(
2
,
10
);
let
result
=
pro
.
put
(
2
,
10
);
```
```
### values<sup>8+(deprecated)</sup>
### values<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[values9+](#values9)替代。
values(): V[]
values(): V[]
获取当前缓冲区中所有值从最近访问到最近最少访问的顺序列表 。
获取当前缓冲区中所有值从最近访问到最近最少访问的顺序列表。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[values<sup>9+</sup>](#values9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -1891,6 +1952,7 @@ values(): V[]
...
@@ -1891,6 +1952,7 @@ values(): V[]
| V
[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 |
| V
[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -1899,15 +1961,16 @@ values(): V[]
...
@@ -1899,15 +1961,16 @@ values(): V[]
let
result
=
pro
.
values
();
let
result
=
pro
.
values
();
```
```
### keys<sup>8+(deprecated)</sup>
### keys<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[keys9+](#keys9)替代。
keys(): K[]
keys(): K[]
获取当前缓冲区中所有键从最近访问到最近最少访问的升序列表。
获取当前缓冲区中所有键从最近访问到最近最少访问的升序列表。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[keys<sup>9+</sup>](#keys9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -1923,15 +1986,16 @@ keys(): K[]
...
@@ -1923,15 +1986,16 @@ keys(): K[]
let
result
=
pro
.
keys
();
let
result
=
pro
.
keys
();
```
```
### remove<sup>8+(deprecated)</sup>
### remove<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[remove9+](#remove9)替代。
remove(key: K): V | undefined
remove(key: K): V | undefined
从当前缓冲区中删除指定的键及其关联的值。
从当前缓冲区中删除指定的键及其关联的值。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[remove<sup>9+</sup>](#remove9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -1953,27 +2017,29 @@ remove(key: K): V | undefined
...
@@ -1953,27 +2017,29 @@ remove(key: K): V | undefined
let
result
=
pro
.
remove
(
20
);
let
result
=
pro
.
remove
(
20
);
```
```
### afterRemoval<sup>8+(deprecated)</sup>
### afterRemoval<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[afterRemoval9+](#afterremoval9)替代。
afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
删除值后执行后续操作。
删除值后执行后续操作。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[afterRemoval<sup>9+</sup>](#afterremoval9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| isEvict | boolean |
否
| 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| isEvict | boolean |
是
| 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| key | K | 是 | 表示删除的键。 |
| key | K | 是 | 表示删除的键。 |
| value | V | 是 | 表示删除的值。 |
| value | V | 是 | 表示删除的值。 |
| newValue | V |
否
| 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
| newValue | V |
是
| 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
**示例:**
**示例:**
```
js
```
js
let
arr
=
[];
let
arr
=
[];
class
ChildLruBuffer
<
K
,
V
>
extends
util
.
LruBuffer
<
K
,
V
>
class
ChildLruBuffer
<
K
,
V
>
extends
util
.
LruBuffer
<
K
,
V
>
...
@@ -1994,15 +2060,17 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
...
@@ -1994,15 +2060,17 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
lru
.
afterRemoval
(
false
,
10
,
30
,
null
);
lru
.
afterRemoval
(
false
,
10
,
30
,
null
);
```
```
### contains<sup>8+(deprecated)</sup>
### contains<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[contains9+](#contains9)替代。
contains(key: K): boolean
contains(key: K): boolean
检查当前缓冲区是否包含指定的键。
检查当前缓冲区是否包含指定的键。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[contains<sup>9+</sup>](#contains9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2018,21 +2086,23 @@ contains(key: K): boolean
...
@@ -2018,21 +2086,23 @@ contains(key: K): boolean
| boolean | 如果缓冲区包含指定的键,则返回
true。 |
| boolean | 如果缓冲区包含指定的键,则返回
true。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
let
result
=
pro
.
contains
(
20
);
let
result
=
pro
.
contains
(
20
);
```
```
### createDefault<sup>8+(deprecated)</sup>
### createDefault<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[createDefault9+](#createdefault9)替代。
createDefault(key: K): V
createDefault(key: K): V
如果未计算特定键的值,则执行后续操作,参数表示丢失的键,返回与键关联的值。
如果未计算特定键的值,则执行后续操作,参数表示丢失的键,返回与键关联的值。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[createDefault<sup>9+</sup>](#createdefault9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2048,20 +2118,22 @@ createDefault(key: K): V
...
@@ -2048,20 +2118,22 @@ createDefault(key: K): V
| V | 返回与键关联的值。 |
| V | 返回与键关联的值。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
let
result
=
pro
.
createDefault
(
50
);
let
result
=
pro
.
createDefault
(
50
);
```
```
### entries<sup>8+(deprecated)</sup>
### entries<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[entries9+](#entries9)替代。
entries(): IterableIterator
<
[K,V]
>
entries(): IterableIterator
<
[K,V]
>
允许迭代包含在这个对象中的所有键值对。
允许迭代包含在这个对象中的所有键值对。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[entries<sup>9+</sup>](#entries9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -2071,21 +2143,23 @@ entries(): IterableIterator<[K,V]>
...
@@ -2071,21 +2143,23 @@ entries(): IterableIterator<[K,V]>
| [K,
V] | 返回一个可迭代数组。 |
| [K,
V] | 返回一个可迭代数组。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
let
result
=
pro
.
entries
();
let
result
=
pro
.
entries
();
```
```
### [Symbol.iterator]<sup>8+(deprecated)</sup>
### [Symbol.iterator]<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[Symbol.iterator9+](#symboliterator9)替代。
[Symbol.iterator]
\(
): IterableIterator
<
[K, V]
>
[Symbol.iterator]
\(
): IterableIterator
<
[K, V]
>
返回一个键值对形式的二维数组。
返回一个键值对形式的二维数组。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[Symbol.iterator<sup>9+</sup>](#symboliterator9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -2095,6 +2169,7 @@ entries(): IterableIterator<[K,V]>
...
@@ -2095,6 +2169,7 @@ entries(): IterableIterator<[K,V]>
| [K,
V] | 返回一个键值对形式的二维数组。 |
| [K,
V] | 返回一个键值对形式的二维数组。 |
**示例:**
**示例:**
```
js
```
js
let
pro
=
new
util
.
LruBuffer
();
let
pro
=
new
util
.
LruBuffer
();
pro
.
put
(
2
,
10
);
pro
.
put
(
2
,
10
);
...
@@ -2106,6 +2181,7 @@ entries(): IterableIterator<[K,V]>
...
@@ -2106,6 +2181,7 @@ entries(): IterableIterator<[K,V]>
用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。
用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
```
js
```
js
interface
ScopeComparable
{
interface
ScopeComparable
{
compareTo
(
other
:
ScopeComparable
):
boolean
;
compareTo
(
other
:
ScopeComparable
):
boolean
;
...
@@ -2197,9 +2273,9 @@ intersect(range: ScopeHelper): ScopeHelper
...
@@ -2197,9 +2273,9 @@ intersect(range: ScopeHelper): ScopeHelper
**参数:**
**参数:**
| 参数名 | 类型
| 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------
--
| ---- | ------------------ |
| ------ | ---------------------------- | ---- | ------------------ |
| range |
[
ScopeHelper
9+
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
| range |
[
ScopeHelper
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
**返回值:**
**返回值:**
...
@@ -2237,9 +2313,9 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):ScopeHelper
...
@@ -2237,9 +2313,9 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):ScopeHelper
**返回值:**
**返回值:**
| 类型
| 说明 |
| 类型 | 说明 |
| ----------------------------
--
| ---------------------------------------- |
| ---------------------------- | ---------------------------------------- |
|
[
ScopeHelper
9+
](
#scopehelper9
)
| 返回当前范围与给定下限和上限范围的交集。 |
|
[
ScopeHelper
](
#scopehelper9
)
| 返回当前范围与给定下限和上限范围的交集。 |
**示例:**
**示例:**
...
@@ -2318,9 +2394,9 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): ScopeHelper
...
@@ -2318,9 +2394,9 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): ScopeHelper
**返回值:**
**返回值:**
| 类型
| 说明 |
| 类型 | 说明 |
| ----------------------------
--
| ------------------------------------ |
| ---------------------------- | ------------------------------------ |
|
[
ScopeHelper
9+
](
#scopehelper9
)
| 返回当前范围和给定下限和上限的并集。 |
|
[
ScopeHelper
](
#scopehelper9
)
| 返回当前范围和给定下限和上限的并集。 |
**示例:**
**示例:**
...
@@ -2344,15 +2420,15 @@ expand(range: ScopeHelper): ScopeHelper
...
@@ -2344,15 +2420,15 @@ expand(range: ScopeHelper): ScopeHelper
**参数:**
**参数:**
| 参数名 | 类型
| 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------
--
| ---- | ------------------ |
| ------ | ---------------------------- | ---- | ------------------ |
| range |
[
ScopeHelper
9+
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
| range |
[
ScopeHelper
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
**返回值:**
**返回值:**
| 类型
| 说明 |
| 类型 | 说明 |
| ----------------------------
--
| ---------------------------------- |
| ---------------------------- | ---------------------------------- |
|
[
ScopeHelper
9+
](
#scopehelper9
)
| 返回包括当前范围和给定范围的并集。 |
|
[
ScopeHelper
](
#scopehelper9
)
| 返回包括当前范围和给定范围的并集。 |
**示例:**
**示例:**
...
@@ -2383,9 +2459,9 @@ expand(value: ScopeType): ScopeHelper
...
@@ -2383,9 +2459,9 @@ expand(value: ScopeType): ScopeHelper
**返回值:**
**返回值:**
| 类型
| 说明 |
| 类型 | 说明 |
| ----------------------------
--
| -------------------------------- |
| ---------------------------- | -------------------------------- |
|
[
ScopeHelper
9+
](
#scopehelper9
)
| 返回包括当前范围和给定值的并集。 |
|
[
ScopeHelper
](
#scopehelper9
)
| 返回包括当前范围和给定值的并集。 |
**示例:**
**示例:**
...
@@ -2439,9 +2515,9 @@ contains(range: ScopeHelper): boolean
...
@@ -2439,9 +2515,9 @@ contains(range: ScopeHelper): boolean
**参数:**
**参数:**
| 参数名 | 类型
| 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------
--
| ---- | ------------------ |
| ------ | ---------------------------- | ---- | ------------------ |
| range |
[
ScopeHelper
9+
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
| range |
[
ScopeHelper
](
#scopehelper9
)
| 是 | 传入一个给定范围。 |
**返回值:**
**返回值:**
...
@@ -2492,20 +2568,23 @@ let range = new util.ScopeHelper(tempLower, tempUpper);
...
@@ -2492,20 +2568,23 @@ let range = new util.ScopeHelper(tempLower, tempUpper);
let
result
=
range
.
clamp
(
tempMiDF
);
let
result
=
range
.
clamp
(
tempMiDF
);
```
```
## Scope<sup>8+(deprecated)</sup>
## Scope<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[ScopeHelper9+](#scopehelper9)替代。
### constructor<sup>8+(deprecated)</sup>
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[ScopeHelper<sup>9+</sup>](#scopehelper9)替代。
> **说明:**<br/>
### constructor<sup>(deprecated)</sup>
> 从API Version 9开始废弃,建议使用[constructor9+](#constructor9)替代。
constructor(lowerObj: ScopeType, upperObj: ScopeType)
constructor(lowerObj: ScopeType, upperObj: ScopeType)
用于创建指定下限和上限的作用域实例的构造函数,返回一个Scope对象。
用于创建指定下限和上限的作用域实例的构造函数,返回一个Scope对象。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[constructor<sup>9+</sup>](#constructor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2522,15 +2601,16 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType)
...
@@ -2522,15 +2601,16 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType)
let
range
=
new
util
.
Scope
(
tempLower
,
tempUpper
);
let
range
=
new
util
.
Scope
(
tempLower
,
tempUpper
);
```
```
### toString<sup>8+(deprecated)</sup>
### toString<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[toString9+](#tostring9)替代。
toString(): string
toString(): string
该字符串化方法返回一个包含当前范围的字符串表示形式。
该字符串化方法返回一个包含当前范围的字符串表示形式。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[toString<sup>9+</sup>](#tostring9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -2540,6 +2620,7 @@ toString(): string
...
@@ -2540,6 +2620,7 @@ toString(): string
| string | 返回包含当前范围对象的字符串表示形式。 |
| string | 返回包含当前范围对象的字符串表示形式。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2547,15 +2628,16 @@ toString(): string
...
@@ -2547,15 +2628,16 @@ toString(): string
let
result
=
range
.
toString
();
let
result
=
range
.
toString
();
```
```
### intersect<sup>8+(deprecated)</sup>
### intersect<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[intersect9+](#intersect9)替代。
intersect(range: Scope): Scope
intersect(range: Scope): Scope
获取给定范围和当前范围的交集。
获取给定范围和当前范围的交集。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[intersect<sup>9+</sup>](#intersect9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2582,15 +2664,16 @@ intersect(range: Scope): Scope
...
@@ -2582,15 +2664,16 @@ intersect(range: Scope): Scope
range
.
intersect
(
rangeFir
);
range
.
intersect
(
rangeFir
);
```
```
### intersect<sup>8+(deprecated)</sup>
### intersect<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[intersect9+](#intersect9)替代。
intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
获取当前范围与给定下限和上限范围的交集。
获取当前范围与给定下限和上限范围的交集。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[intersect<sup>9+</sup>](#intersect9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2607,6 +2690,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
...
@@ -2607,6 +2690,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
|
[
Scope
](
#scope8
)
| 返回当前范围与给定下限和上限范围的交集。 |
|
[
Scope
](
#scope8
)
| 返回当前范围与给定下限和上限范围的交集。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2616,15 +2700,16 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
...
@@ -2616,15 +2700,16 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
let
result
=
range
.
intersect
(
tempMiDF
,
tempMidS
);
let
result
=
range
.
intersect
(
tempMiDF
,
tempMidS
);
```
```
### getUpper<sup>8+(deprecated)</sup>
### getUpper<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getUpper9+](#getupper9)替代。
getUpper(): ScopeType
getUpper(): ScopeType
获取当前范围的上限。
获取当前范围的上限。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getUpper<sup>9+</sup>](#getupper9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -2634,6 +2719,7 @@ getUpper(): ScopeType
...
@@ -2634,6 +2719,7 @@ getUpper(): ScopeType
|
[
ScopeType
](
#scopetype8
)
| 返回当前范围的上限值。 |
|
[
ScopeType
](
#scopetype8
)
| 返回当前范围的上限值。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2641,15 +2727,16 @@ getUpper(): ScopeType
...
@@ -2641,15 +2727,16 @@ getUpper(): ScopeType
let
result
=
range
.
getUpper
();
let
result
=
range
.
getUpper
();
```
```
### getLower<sup>8+(deprecated)</sup>
### getLower<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[getLower9+](#getlower9)替代。
getLower(): ScopeType
getLower(): ScopeType
获取当前范围的下限。
获取当前范围的下限。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[getLower<sup>9+</sup>](#getlower9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**返回值:**
**返回值:**
...
@@ -2659,6 +2746,7 @@ getLower(): ScopeType
...
@@ -2659,6 +2746,7 @@ getLower(): ScopeType
|
[
ScopeType
](
#scopetype8
)
| 返回当前范围的下限值。 |
|
[
ScopeType
](
#scopetype8
)
| 返回当前范围的下限值。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2666,15 +2754,16 @@ getLower(): ScopeType
...
@@ -2666,15 +2754,16 @@ getLower(): ScopeType
let
result
=
range
.
getLower
();
let
result
=
range
.
getLower
();
```
```
### expand<sup>8+(deprecated)</sup>
### expand<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[expand9+](#expand9)替代。
expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
创建并返回包括当前范围和给定下限和上限的并集。
创建并返回包括当前范围和给定下限和上限的并集。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[expand<sup>9+</sup>](#expand9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2701,15 +2790,16 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
...
@@ -2701,15 +2790,16 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
let
result
=
range
.
expand
(
tempMiDF
,
tempMidS
);
let
result
=
range
.
expand
(
tempMiDF
,
tempMidS
);
```
```
### expand<sup>8+(deprecated)</sup>
### expand<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[expand9+](#expand9)替代。
expand(range: Scope): Scope
expand(range: Scope): Scope
创建并返回包括当前范围和给定范围的并集。
创建并返回包括当前范围和给定范围的并集。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[expand<sup>9+</sup>](#expand9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2725,6 +2815,7 @@ expand(range: Scope): Scope
...
@@ -2725,6 +2815,7 @@ expand(range: Scope): Scope
|
[
Scope
](
#scope8
)
| 返回包括当前范围和给定范围的并集。 |
|
[
Scope
](
#scope8
)
| 返回包括当前范围和给定范围的并集。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2735,15 +2826,16 @@ expand(range: Scope): Scope
...
@@ -2735,15 +2826,16 @@ expand(range: Scope): Scope
let
result
=
range
.
expand
(
rangeFir
);
let
result
=
range
.
expand
(
rangeFir
);
```
```
### expand<sup>8+(deprecated)</sup>
### expand<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[expand9+](#expand9)替代。
expand(value: ScopeType): Scope
expand(value: ScopeType): Scope
创建并返回包括当前范围和给定值的并集。
创建并返回包括当前范围和给定值的并集。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[expand<sup>9+</sup>](#expand9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2759,6 +2851,7 @@ expand(value: ScopeType): Scope
...
@@ -2759,6 +2851,7 @@ expand(value: ScopeType): Scope
|
[
Scope
](
#scope8
)
| 返回包括当前范围和给定值的并集。 |
|
[
Scope
](
#scope8
)
| 返回包括当前范围和给定值的并集。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2767,15 +2860,16 @@ expand(value: ScopeType): Scope
...
@@ -2767,15 +2860,16 @@ expand(value: ScopeType): Scope
let
result
=
range
.
expand
(
tempMiDF
);
let
result
=
range
.
expand
(
tempMiDF
);
```
```
### contains<sup>8+(deprecated)</sup>
### contains<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[contains9+](#contains9)替代。
contains(value: ScopeType): boolean
contains(value: ScopeType): boolean
检查给定value是否包含在当前范围内。
检查给定value是否包含在当前范围内。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[contains<sup>9+</sup>](#contains9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2791,6 +2885,7 @@ contains(value: ScopeType): boolean
...
@@ -2791,6 +2885,7 @@ contains(value: ScopeType): boolean
| boolean | 如果给定值包含在当前范围内返回true,否则返回false。 |
| boolean | 如果给定值包含在当前范围内返回true,否则返回false。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -2799,15 +2894,16 @@ contains(value: ScopeType): boolean
...
@@ -2799,15 +2894,16 @@ contains(value: ScopeType): boolean
range
.
contains
(
tempMiDF
);
range
.
contains
(
tempMiDF
);
```
```
### contains<sup>8+(deprecated)</sup>
### contains<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[contains9+](#contains9)替代。
contains(range: Scope): boolean
contains(range: Scope): boolean
检查给定range是否在当前范围内。
检查给定range是否在当前范围内。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[contains<sup>9+</sup>](#contains9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2834,15 +2930,17 @@ contains(range: Scope): boolean
...
@@ -2834,15 +2930,17 @@ contains(range: Scope): boolean
let
result
=
range
.
contains
(
rangeSec
);
let
result
=
range
.
contains
(
rangeSec
);
```
```
### clamp<sup>
8+
(deprecated)</sup>
### clamp<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[clamp9+](#clamp9)替代。
clamp(value: ScopeType): ScopeType
clamp(value: ScopeType): ScopeType
将给定值限定到当前范围内。
将给定值限定到当前范围内。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[clamp<sup>9+</sup>](#clamp9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -2858,6 +2956,7 @@ clamp(value: ScopeType): ScopeType
...
@@ -2858,6 +2956,7 @@ clamp(value: ScopeType): ScopeType
|
[
ScopeType
](
#scopetype8
)
| 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 |
|
[
ScopeType
](
#scopetype8
)
| 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 |
**示例:**
**示例:**
```
js
```
js
let
tempLower
=
new
Temperature
(
30
);
let
tempLower
=
new
Temperature
(
30
);
let
tempUpper
=
new
Temperature
(
40
);
let
tempUpper
=
new
Temperature
(
40
);
...
@@ -3068,36 +3167,40 @@ that.decode(array).then(val=>{
...
@@ -3068,36 +3167,40 @@ that.decode(array).then(val=>{
```
```
## Base64<sup>8+(deprecated)</sup>
## Base64<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[Base64Helper9+](#base64helper9)替代。
### constructor<sup>8+(deprecated)</sup>
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[Base64Helper<sup>9+</sup>](#base64helper9)替代。
> **说明:**<br/>
### constructor<sup>(deprecated)</sup>
> 从API Version 9开始废弃,建议使用[constructor9+](#constructor9)替代。
constructor()
constructor()
Base64的构造函数。
Base64的构造函数。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[constructor<sup>9+</sup>](#constructor9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**示例:**
**示例:**
```
js
```
js
let
base64
=
new
util
.
Base64
();
let
base64
=
new
util
.
Base64
();
```
```
### encodeSync<sup>8+(deprecated)</sup>
### encodeSync<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encodeSync9+](#encodesync9)替代。
encodeSync(src: Uint8Array): Uint8Array
encodeSync(src: Uint8Array): Uint8Array
通过输入参数编码后输出对应文本。
通过输入参数编码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[encodeSync<sup>9+</sup>](#encodesync9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3120,15 +3223,16 @@ encodeSync(src: Uint8Array): Uint8Array
...
@@ -3120,15 +3223,16 @@ encodeSync(src: Uint8Array): Uint8Array
let
result
=
that
.
encodeSync
(
array
);
let
result
=
that
.
encodeSync
(
array
);
```
```
### encodeToStringSync<sup>8+(deprecated)</sup>
### encodeToStringSync<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encodeToStringSync9+](#encodetostringsync9)替代。
encodeToStringSync(src: Uint8Array): string
encodeToStringSync(src: Uint8Array): string
通过输入参数编码后输出对应文本。
通过输入参数编码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[encodeToStringSync<sup>9+</sup>](#encodetostringsync9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3144,21 +3248,23 @@ encodeToStringSync(src: Uint8Array): string
...
@@ -3144,21 +3248,23 @@ encodeToStringSync(src: Uint8Array): string
| string | 返回编码后的字符串。 |
| string | 返回编码后的字符串。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
Base64
();
let
that
=
new
util
.
Base64
();
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
let
result
=
that
.
encodeToStringSync
(
array
);
let
result
=
that
.
encodeToStringSync
(
array
);
```
```
### decodeSync<sup>8+(deprecated)</sup>
### decodeSync<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[decodeSync9+](#decodesync9)替代。
decodeSync(src: Uint8Array | string): Uint8Array
decodeSync(src: Uint8Array | string): Uint8Array
通过输入参数解码后输出对应文本。
通过输入参数解码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[decodeSync<sup>9+</sup>](#decodesync9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3174,21 +3280,23 @@ decodeSync(src: Uint8Array | string): Uint8Array
...
@@ -3174,21 +3280,23 @@ decodeSync(src: Uint8Array | string): Uint8Array
| Uint8Array | 返回解码后新分配的Uint8数组。 |
| Uint8Array | 返回解码后新分配的Uint8数组。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
Base64
();
let
that
=
new
util
.
Base64
();
let
buff
=
'
czEz
'
;
let
buff
=
'
czEz
'
;
let
result
=
that
.
decodeSync
(
buff
);
let
result
=
that
.
decodeSync
(
buff
);
```
```
### encode<sup>8+(deprecated)</sup>
### encode<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encode9+](#encode9)替代。
encode(src: Uint8Array): Promise
<
Uint8Array
>
encode(src: Uint8Array): Promise
<
Uint8Array
>
通过输入参数异步编码后输出对应文本。
通过输入参数异步编码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[encode<sup>9+</sup>](#encode9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3204,6 +3312,7 @@ encode(src: Uint8Array): Promise<Uint8Array>
...
@@ -3204,6 +3312,7 @@ encode(src: Uint8Array): Promise<Uint8Array>
| Promise
<
Uint8Array
>
| 返回异步编码后新分配的Uint8数组。 |
| Promise
<
Uint8Array
>
| 返回异步编码后新分配的Uint8数组。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
Base64
();
let
that
=
new
util
.
Base64
();
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
...
@@ -3215,15 +3324,16 @@ encode(src: Uint8Array): Promise<Uint8Array>
...
@@ -3215,15 +3324,16 @@ encode(src: Uint8Array): Promise<Uint8Array>
})
})
```
```
### encodeToString<sup>8+(deprecated)</sup>
### encodeToString<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[encodeToString9+](#encodetostring9)替代。
encodeToString(src: Uint8Array): Promise
<
string
>
encodeToString(src: Uint8Array): Promise
<
string
>
通过输入参数异步编码后输出对应文本。
通过输入参数异步编码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[encodeToString<sup>9+</sup>](#encodetostring9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3239,6 +3349,7 @@ encodeToString(src: Uint8Array): Promise<string>
...
@@ -3239,6 +3349,7 @@ encodeToString(src: Uint8Array): Promise<string>
| Promise
<
string
>
| 返回异步编码后的字符串。 |
| Promise
<
string
>
| 返回异步编码后的字符串。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
Base64
();
let
that
=
new
util
.
Base64
();
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
let
array
=
new
Uint8Array
([
115
,
49
,
51
]);
...
@@ -3247,15 +3358,17 @@ encodeToString(src: Uint8Array): Promise<string>
...
@@ -3247,15 +3358,17 @@ encodeToString(src: Uint8Array): Promise<string>
})
})
```
```
### decode<sup>
8+
(deprecated)</sup>
### decode<sup>(deprecated)</sup>
> **说明:**<br/>
> 从API Version 9开始废弃,建议使用[decode9+](#decode9)替代。
decode(src: Uint8Array | string): Promise
<
Uint8Array
>
decode(src: Uint8Array | string): Promise
<
Uint8Array
>
通过输入参数异步解码后输出对应文本。
通过输入参数异步解码后输出对应文本。
> **说明:**
>
> 从API Version 8开始支持,从API Version 9开始废弃,建议使用[decode<sup>9+</sup>](#decode9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
**参数:**
...
@@ -3271,6 +3384,7 @@ decode(src: Uint8Array | string): Promise<Uint8Array>
...
@@ -3271,6 +3384,7 @@ decode(src: Uint8Array | string): Promise<Uint8Array>
| Promise
<
Uint8Array
>
| 返回异步解码后新分配的Uint8数组。 |
| Promise
<
Uint8Array
>
| 返回异步解码后新分配的Uint8数组。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
Base64
();
let
that
=
new
util
.
Base64
();
let
array
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
let
array
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
...
@@ -3294,6 +3408,7 @@ Types的构造函数。
...
@@ -3294,6 +3408,7 @@ Types的构造函数。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**示例:**
**示例:**
```
js
```
js
let
type
=
new
util
.
types
();
let
type
=
new
util
.
types
();
```
```
...
@@ -3320,6 +3435,7 @@ isAnyArrayBuffer(value: Object): boolean
...
@@ -3320,6 +3435,7 @@ isAnyArrayBuffer(value: Object): boolean
| boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 |
| boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isAnyArrayBuffer
(
new
ArrayBuffer
(
0
));
let
result
=
that
.
isAnyArrayBuffer
(
new
ArrayBuffer
(
0
));
...
@@ -3349,6 +3465,7 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A
...
@@ -3349,6 +3465,7 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A
| boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isArrayBufferView
(
new
Int8Array
([]));
let
result
=
that
.
isArrayBufferView
(
new
Int8Array
([]));
...
@@ -3376,6 +3493,7 @@ isArgumentsObject(value: Object): boolean
...
@@ -3376,6 +3493,7 @@ isArgumentsObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
function
foo
()
{
function
foo
()
{
...
@@ -3406,6 +3524,7 @@ isArrayBuffer(value: Object): boolean
...
@@ -3406,6 +3524,7 @@ isArrayBuffer(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isArrayBuffer
(
new
ArrayBuffer
(
0
));
let
result
=
that
.
isArrayBuffer
(
new
ArrayBuffer
(
0
));
...
@@ -3433,6 +3552,7 @@ isAsyncFunction(value: Object): boolean
...
@@ -3433,6 +3552,7 @@ isAsyncFunction(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isAsyncFunction
(
async
function
foo
()
{});
let
result
=
that
.
isAsyncFunction
(
async
function
foo
()
{});
...
@@ -3460,6 +3580,7 @@ isBooleanObject(value: Object): boolean
...
@@ -3460,6 +3580,7 @@ isBooleanObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isBooleanObject
(
new
Boolean
(
true
));
let
result
=
that
.
isBooleanObject
(
new
Boolean
(
true
));
...
@@ -3487,6 +3608,7 @@ isBoxedPrimitive(value: Object): boolean
...
@@ -3487,6 +3608,7 @@ isBoxedPrimitive(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isBoxedPrimitive
(
new
Boolean
(
false
));
let
result
=
that
.
isBoxedPrimitive
(
new
Boolean
(
false
));
...
@@ -3514,6 +3636,7 @@ isDataView(value: Object): boolean
...
@@ -3514,6 +3636,7 @@ isDataView(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
const
ab
=
new
ArrayBuffer
(
20
);
const
ab
=
new
ArrayBuffer
(
20
);
...
@@ -3542,6 +3665,7 @@ isDate(value: Object): boolean
...
@@ -3542,6 +3665,7 @@ isDate(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isDate
(
new
Date
());
let
result
=
that
.
isDate
(
new
Date
());
...
@@ -3569,6 +3693,7 @@ isExternal(value: Object): boolean
...
@@ -3569,6 +3693,7 @@ isExternal(value: Object): boolean
| boolean | 判断的结果,如果是内置包含native
External类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含native
External类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isExternal
(
true
);
let
result
=
that
.
isExternal
(
true
);
...
@@ -3596,6 +3721,7 @@ isFloat32Array(value: Object): boolean
...
@@ -3596,6 +3721,7 @@ isFloat32Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isFloat32Array
(
new
Float32Array
());
let
result
=
that
.
isFloat32Array
(
new
Float32Array
());
...
@@ -3623,6 +3749,7 @@ isFloat64Array(value: Object): boolean
...
@@ -3623,6 +3749,7 @@ isFloat64Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isFloat64Array
(
new
Float64Array
());
let
result
=
that
.
isFloat64Array
(
new
Float64Array
());
...
@@ -3650,6 +3777,7 @@ isGeneratorFunction(value: Object): boolean
...
@@ -3650,6 +3777,7 @@ isGeneratorFunction(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isGeneratorFunction
(
function
*
foo
()
{});
let
result
=
that
.
isGeneratorFunction
(
function
*
foo
()
{});
...
@@ -3677,6 +3805,7 @@ isGeneratorObject(value: Object): boolean
...
@@ -3677,6 +3805,7 @@ isGeneratorObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
function
*
foo
()
{}
function
*
foo
()
{}
...
@@ -3706,6 +3835,7 @@ isInt8Array(value: Object): boolean
...
@@ -3706,6 +3835,7 @@ isInt8Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isInt8Array
(
new
Int8Array
([]));
let
result
=
that
.
isInt8Array
(
new
Int8Array
([]));
...
@@ -3733,6 +3863,7 @@ isInt16Array(value: Object): boolean
...
@@ -3733,6 +3863,7 @@ isInt16Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isInt16Array
(
new
Int16Array
([]));
let
result
=
that
.
isInt16Array
(
new
Int16Array
([]));
...
@@ -3760,6 +3891,7 @@ isInt32Array(value: Object): boolean
...
@@ -3760,6 +3891,7 @@ isInt32Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isInt32Array
(
new
Int32Array
([]));
let
result
=
that
.
isInt32Array
(
new
Int32Array
([]));
...
@@ -3787,6 +3919,7 @@ isMap(value: Object): boolean
...
@@ -3787,6 +3919,7 @@ isMap(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isMap
(
new
Map
());
let
result
=
that
.
isMap
(
new
Map
());
...
@@ -3803,6 +3936,7 @@ isMapIterator(value: Object): boolean
...
@@ -3803,6 +3936,7 @@ isMapIterator(value: Object): boolean
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 |
| value | Object | 是 | 待检测对象。 |
...
@@ -3814,6 +3948,7 @@ isMapIterator(value: Object): boolean
...
@@ -3814,6 +3948,7 @@ isMapIterator(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
const
map
=
new
Map
();
const
map
=
new
Map
();
...
@@ -3842,6 +3977,7 @@ isNativeError(value: Object): boolean
...
@@ -3842,6 +3977,7 @@ isNativeError(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isNativeError
(
new
TypeError
());
let
result
=
that
.
isNativeError
(
new
TypeError
());
...
@@ -3869,6 +4005,7 @@ isNumberObject(value: Object): boolean
...
@@ -3869,6 +4005,7 @@ isNumberObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isNumberObject
(
new
Number
(
0
));
let
result
=
that
.
isNumberObject
(
new
Number
(
0
));
...
@@ -3896,6 +4033,7 @@ isPromise(value: Object): boolean
...
@@ -3896,6 +4033,7 @@ isPromise(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isPromise
(
Promise
.
resolve
(
1
));
let
result
=
that
.
isPromise
(
Promise
.
resolve
(
1
));
...
@@ -3923,6 +4061,7 @@ isProxy(value: Object): boolean
...
@@ -3923,6 +4061,7 @@ isProxy(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
const
target
=
{};
const
target
=
{};
...
@@ -3952,6 +4091,7 @@ isRegExp(value: Object): boolean
...
@@ -3952,6 +4091,7 @@ isRegExp(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isRegExp
(
new
RegExp
(
'
abc
'
));
let
result
=
that
.
isRegExp
(
new
RegExp
(
'
abc
'
));
...
@@ -3979,6 +4119,7 @@ isSet(value: Object): boolean
...
@@ -3979,6 +4119,7 @@ isSet(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isSet
(
new
Set
());
let
result
=
that
.
isSet
(
new
Set
());
...
@@ -4006,6 +4147,7 @@ isSetIterator(value: Object): boolean
...
@@ -4006,6 +4147,7 @@ isSetIterator(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
const
set
=
new
Set
();
const
set
=
new
Set
();
...
@@ -4034,6 +4176,7 @@ isStringObject(value: Object): boolean
...
@@ -4034,6 +4176,7 @@ isStringObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isStringObject
(
new
String
(
'
foo
'
));
let
result
=
that
.
isStringObject
(
new
String
(
'
foo
'
));
...
@@ -4061,6 +4204,7 @@ isSymbolObject(value: Object): boolean
...
@@ -4061,6 +4204,7 @@ isSymbolObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
const
symbols
=
Symbol
(
'
foo
'
);
const
symbols
=
Symbol
(
'
foo
'
);
...
@@ -4091,6 +4235,7 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui
...
@@ -4091,6 +4235,7 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui
| boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isTypedArray
(
new
Float64Array
([]));
let
result
=
that
.
isTypedArray
(
new
Float64Array
([]));
...
@@ -4118,6 +4263,7 @@ isUint8Array(value: Object): boolean
...
@@ -4118,6 +4263,7 @@ isUint8Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isUint8Array
(
new
Uint8Array
([]));
let
result
=
that
.
isUint8Array
(
new
Uint8Array
([]));
...
@@ -4145,6 +4291,7 @@ isUint8ClampedArray(value: Object): boolean
...
@@ -4145,6 +4291,7 @@ isUint8ClampedArray(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isUint8ClampedArray
(
new
Uint8ClampedArray
([]));
let
result
=
that
.
isUint8ClampedArray
(
new
Uint8ClampedArray
([]));
...
@@ -4172,6 +4319,7 @@ isUint16Array(value: Object): boolean
...
@@ -4172,6 +4319,7 @@ isUint16Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isUint16Array
(
new
Uint16Array
([]));
let
result
=
that
.
isUint16Array
(
new
Uint16Array
([]));
...
@@ -4199,6 +4347,7 @@ isUint32Array(value: Object): boolean
...
@@ -4199,6 +4347,7 @@ isUint32Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isUint32Array
(
new
Uint32Array
([]));
let
result
=
that
.
isUint32Array
(
new
Uint32Array
([]));
...
@@ -4226,6 +4375,7 @@ isWeakMap(value: Object): boolean
...
@@ -4226,6 +4375,7 @@ isWeakMap(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isWeakMap
(
new
WeakMap
());
let
result
=
that
.
isWeakMap
(
new
WeakMap
());
...
@@ -4253,6 +4403,7 @@ isWeakSet(value: Object): boolean
...
@@ -4253,6 +4403,7 @@ isWeakSet(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isWeakSet
(
new
WeakSet
());
let
result
=
that
.
isWeakSet
(
new
WeakSet
());
...
@@ -4280,6 +4431,7 @@ isBigInt64Array(value: Object): boolean
...
@@ -4280,6 +4431,7 @@ isBigInt64Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的BigInt64Array类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的BigInt64Array类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isBigInt64Array
(
new
BigInt64Array
([]));
let
result
=
that
.
isBigInt64Array
(
new
BigInt64Array
([]));
...
@@ -4307,6 +4459,7 @@ isBigUint64Array(value: Object): boolean
...
@@ -4307,6 +4459,7 @@ isBigUint64Array(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的BigUint64Array类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的BigUint64Array类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isBigUint64Array
(
new
BigUint64Array
([]));
let
result
=
that
.
isBigUint64Array
(
new
BigUint64Array
([]));
...
@@ -4334,6 +4487,7 @@ isModuleNamespaceObject(value: Object): boolean
...
@@ -4334,6 +4487,7 @@ isModuleNamespaceObject(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的Module Namespace Object类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的Module Namespace Object类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
import
url
from
'
@ohos.url
'
import
url
from
'
@ohos.url
'
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
...
@@ -4362,6 +4516,7 @@ isSharedArrayBuffer(value: Object): boolean
...
@@ -4362,6 +4516,7 @@ isSharedArrayBuffer(value: Object): boolean
| boolean | 判断的结果,如果是内置包含的SharedArrayBuffer类型为true,反之为false。 |
| boolean | 判断的结果,如果是内置包含的SharedArrayBuffer类型为true,反之为false。 |
**示例:**
**示例:**
```
js
```
js
let
that
=
new
util
.
types
();
let
that
=
new
util
.
types
();
let
result
=
that
.
isSharedArrayBuffer
(
new
SharedArrayBuffer
(
0
));
let
result
=
that
.
isSharedArrayBuffer
(
new
SharedArrayBuffer
(
0
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录