Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
0a1d2520
D
Docs
项目概览
OpenHarmony
/
Docs
11 个月 前同步成功
通知
158
Star
292
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0a1d2520
编写于
5月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!18885 master:timer和console优化
Merge pull request !18885 from 葛亚芳/master
上级
6ee6e57a
b42ca774
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
9 deletion
+28
-9
zh-cn/application-dev/reference/apis/js-apis-logs.md
zh-cn/application-dev/reference/apis/js-apis-logs.md
+24
-5
zh-cn/application-dev/reference/apis/js-apis-timer.md
zh-cn/application-dev/reference/apis/js-apis-timer.md
+4
-4
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-logs.md
浏览文件 @
0a1d2520
...
...
@@ -19,9 +19,10 @@ debug(message: string, ...arguments: any[]): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----------- |
| message | string | 是 | 表示要打印的文本信息。 |
| arguments | any | 否 | 表示其余要打印的信息或message的替换值。 |
| arguments | any
[]
| 否 | 表示其余要打印的信息或message的替换值。 |
**示例:**
```
js
const
number
=
5
;
console
.
debug
(
'
count: %d
'
,
number
);
// 格式化输出替换message中的文本。
...
...
@@ -45,9 +46,10 @@ log(message: string, ...arguments: any[]): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----------- |
| message | string | 是 | 表示要打印的文本信息。 |
| arguments | any | 否 |表示其余要打印的信息或message的替换值。 |
| arguments | any
[]
| 否 |表示其余要打印的信息或message的替换值。 |
**示例:**
```
js
const
number
=
5
;
console
.
log
(
'
count: %d
'
,
number
);
// 格式化输出替换message中的文本。
...
...
@@ -71,9 +73,10 @@ info(message: string, ...arguments: any[]): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----------- |
| message | string | 是 | 表示要打印的文本信息。 |
| arguments | any | 否 | 表示其余要打印的信息或message的替换值。 |
| arguments | any
[]
| 否 | 表示其余要打印的信息或message的替换值。 |
**示例:**
```
js
const
number
=
5
;
console
.
info
(
'
count: %d
'
,
number
);
// 格式化输出替换message中的文本。
...
...
@@ -97,9 +100,10 @@ warn(message: string, ...arguments: any[]): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----------- |
| message | string | 是 | 表示要打印的警告信息。 |
| arguments | any | 否 | 表示其余要打印的信息或message的替换值。 |
| arguments | any
[]
| 否 | 表示其余要打印的信息或message的替换值。 |
**示例:**
```
js
const
str
=
"
name should be string
"
;
console
.
warn
(
'
warn: %d
'
,
str
);
// 格式化输出替换message中的文本。
...
...
@@ -123,10 +127,11 @@ error(message: string, ...arguments: any[]): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----------- |
| message | string | 是 | 表示要打印的错误信息。 |
| arguments | any | 否 | 表示其余要打印的信息或message的替换值。 |
| arguments | any
[]
| 否 | 表示其余要打印的信息或message的替换值。 |
**示例:**
```
js
const
str
=
"
value is not defined
"
;
console
.
error
(
'
error: %d
'
,
str
);
// 格式化输出替换message中的文本。
...
...
@@ -153,6 +158,7 @@ assert(value?: Object, ...arguments: Object[]): void
| arguments | Object | 否 | value为假(false)的后续错误消息打印。省略则不打印。|
**示例:**
```
js
console
.
assert
(
true
,
'
does nothing
'
);
// 表达式结果值为true, 无打印。
console
.
assert
(
2
%
1
==
0
,
'
does nothing
'
);
// 表达式结果值为true, 无打印。
...
...
@@ -180,6 +186,7 @@ count(label?: string): void
**示例:**
```
js
console
.
count
()
// default: 1
...
...
@@ -210,6 +217,7 @@ countReset(label?: string): void
| label | string | 否 | 计数器标签名。默认值为'default'。|
**示例:**
```
js
console
.
count
(
'
abc
'
);
// abc: 1
...
...
@@ -234,6 +242,7 @@ dir(dir?: Object): void
**示例:**
```
js
let
a
=
{
foo
:
{
bar
:
{
baz
:
true
}
}};
console
.
dir
(
a
);
...
...
@@ -258,6 +267,7 @@ dirxml(...arguments: Object[]): void
| arguments | Object | 是 | 要打印的信息。 |
**示例:**
```
js
const
number
=
5
;
console
.
dirxml
(
'
count: %d
'
,
number
);
...
...
@@ -284,6 +294,7 @@ group(...arguments: Object[]): void
| arguments | Object | 否 | 要打印的信息。 |
**示例:**
```
js
console
.
log
(
"
outter
"
);
// outter
...
...
@@ -313,6 +324,7 @@ groupCollapsed(...arguments: Object[]): void
**示例:**
```
js
console
.
groupCollapsed
(
"
outter
"
);
// outter
...
...
@@ -335,6 +347,7 @@ groupEnd(): void
**示例:**
```
js
console
.
log
(
"
outter
"
);
// outter
...
...
@@ -362,6 +375,7 @@ table(tableData?: Object): void
| tableData | Object | 否 | 要打印为表格形式的对象。省略则无任何打印。 |
**示例:**
```
js
console
.
table
([
1
,
2
,
3
]);
// ┌─────────┬────────┐
...
...
@@ -382,6 +396,7 @@ console.table({ a: [1, 2, 3, 4, 5], b: 5, c: { e: 5 } });
// │ c │ │ │ │ │ │ 5 │ │
// └─────────┴───┴───┴───┴───┴───┴───┴────────┘
```
## console.time<sup>10+</sup>
time(label?: string): void
...
...
@@ -397,6 +412,7 @@ time(label?: string): void
| label | string | 否 | 计时器标识。默认值为'default'。 |
**示例:**
```
js
console
.
time
(
'
abc
'
);
```
...
...
@@ -416,6 +432,7 @@ timeEnd(label?: string): void
| label | string | 否 | 计时器标识。默认值为'default' |
**示例:**
```
js
console
.
time
(
'
abc
'
);
console
.
timeEnd
(
'
abc
'
);
...
...
@@ -438,6 +455,7 @@ timeLog(label?: string, ...arguments: Object[]): void
| arguments | Object | 否 | 需要打印的其他日志。 |
**示例:**
```
js
console
.
time
(
'
timer1
'
);
console
.
timeLog
(
'
timer1
'
,
17
);
...
...
@@ -461,6 +479,7 @@ trace(...arguments: Object[]): void
| arguments | Object | 否 | 需要打印的其他日志。省略则仅打印堆栈信息。|
**示例:**
```
js
console
.
trace
();
// Trace:
...
...
zh-cn/application-dev/reference/apis/js-apis-timer.md
浏览文件 @
0a1d2520
...
...
@@ -20,7 +20,7 @@ setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): num
| -------- | -------- | -------- | -------- |
| handler | Function
\|
string | 是 | 定时器到期后执行函数。类型为string则打印Error信息,不进行其他处理。 |
| delay | number | 否 | 延迟的毫秒数,函数的调用会在该延迟之后发生。如果省略该参数,delay取默认值0,意味着“马上”执行,或尽快执行。 |
| ...arguments |
Array
<
any
>
| 否 | 附加参数,一旦定时器到期,它们会作为参数传递给handler。 |
| ...arguments |
any[]
| 否 | 附加参数,一旦定时器到期,它们会作为参数传递给handler。 |
**返回值:**
...
...
@@ -41,7 +41,7 @@ setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): num
clearTimeout(timeoutID?: number): void
取消了先前
通过调用setTimeout()建立的定时器。
可取消
通过调用setTimeout()建立的定时器。
**系统能力:**
SystemCapability.ArkUI.ArkUI.Full
...
...
@@ -75,7 +75,7 @@ setInterval(handler: Function | string, delay: number, ...arguments: any[]): num
| -------- | -------- | -------- | -------- |
| handler | Function
\|
string | 是 | 要重复调用的函数。类型为string则打印Error信息,不进行其他处理。|
| delay | number | 是 | 延迟的毫秒数,函数的调用会在该延迟之后发生。 |
| ...arguments |
Array
<
any
>
| 否 | 附加参数,一旦定时器到期,他们会作为参数传递给handler。 |
| ...arguments |
any[]
| 否 | 附加参数,一旦定时器到期,他们会作为参数传递给handler。 |
**返回值:**
...
...
@@ -96,7 +96,7 @@ setInterval(handler: Function | string, delay: number, ...arguments: any[]): num
clearInterval(intervalID?: number): void
可取消
先前
通过setInterval()设置的重复定时任务。
可取消通过setInterval()设置的重复定时任务。
**系统能力:**
SystemCapability.ArkUI.ArkUI.Full
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录