未验证 提交 0a1d2520 编写于 作者: O openharmony_ci 提交者: Gitee

!18885 master:timer和console优化

Merge pull request !18885 from 葛亚芳/master
......@@ -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:
......
......@@ -20,7 +20,7 @@ setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): num
| -------- | -------- | -------- | -------- |
| handler | Function \| string | 是 | 定时器到期后执行函数。类型为string则打印Error信息,不进行其他处理。 |
| delay | number | 否 | 延迟的毫秒数,函数的调用会在该延迟之后发生。如果省略该参数,delay取默认值0,意味着“马上”执行,或尽快执行。 |
| ...arguments | Array&lt;any&gt; | 否 | 附加参数,一旦定时器到期,它们会作为参数传递给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&lt;any&gt; | 否 | 附加参数,一旦定时器到期,他们会作为参数传递给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.
先完成此消息的编辑!
想要评论请 注册