diff --git a/zh-cn/application-dev/reference/apis/js-apis-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-brightness.md index 17676f2c3a129536fcce34ca4e5cb418676d736a..e313d9fafc58bfd6e787c37aea890833f4965c7a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-brightness.md @@ -1,10 +1,10 @@ # 屏幕亮度 +该模块提供屏幕亮度的设置接口。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -该模块提供屏幕亮度的设置接口。 - ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-logs.md b/zh-cn/application-dev/reference/apis/js-apis-logs.md index ed92b8b2c47d6826c1ba0c90178046cca60678ba..81203760b52838389b008cae779e23116380bff7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-logs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-logs.md @@ -1,7 +1,12 @@ # 日志打印 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.hilog`](js-apis-hilog.md)'。 +本模块提供基础的日志打印能力,支持按照日志级别打印日志信息。 + +如果需要使用更高级的日志打印服务,比如按照指定标识筛选日志内容,推荐使用[`@ohos.hilog`](js-apis-hilog.md)。 + +> **说明:** +> +> 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## console.debug @@ -9,10 +14,13 @@ debug(message: string): void 打印debug级别的日志信息。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------ | ---- | ----------- | - | message | string | 是 | 表示要打印的文本信息。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| message | string | 是 | 表示要打印的文本信息。 | ## console.log @@ -21,10 +29,13 @@ log(message: string): void 打印debug级别的日志信息。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------ | ---- | ----------- | - | message | string | 是 | 表示要打印的文本信息。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| message | string | 是 | 表示要打印的文本信息。 | ## console.info @@ -33,10 +44,13 @@ info(message: string): void 打印info级别的日志信息。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------ | ---- | ----------- | - | message | string | 是 | 表示要打印的文本信息。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| message | string | 是 | 表示要打印的文本信息。 | ## console.warn @@ -45,10 +59,13 @@ warn(message: string): void 打印warn级别的日志信息。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------ | ---- | ----------- | - | message | string | 是 | 表示要打印的文本信息。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| message | string | 是 | 表示要打印的文本信息。 | ## console.error @@ -57,10 +74,13 @@ error(message: string): void 打印error级别的日志信息。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------ | ---- | ----------- | - | message | string | 是 | 表示要打印的文本信息。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| message | string | 是 | 表示要打印的文本信息。 | ## 示例 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md index 3a52e071218063300184d674c36bafbced129641..2c4b2dedd6ad05b58909ef2018d0c7abe46743c4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md @@ -1,6 +1,6 @@ # 电量信息 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.batteryInfo`](js-apis-battery-info.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -26,16 +26,9 @@ getStatus(Object): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| charging | boolean | 当前电池是否在充电中。 | -| level | number | 当前电池的电量,取值范围:0.00 - 1.00 。 | +| success | (data: [BatteryResponse](#batteryresponse)) => void | 否 | 接口调用成功的回调函数。| +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。| +| complete | () => void | 否 | 接口调用结束的回调函数。 | **示例:** @@ -52,4 +45,11 @@ export default { }); }, } -``` \ No newline at end of file +``` + +## BatteryResponse + +| 参数名 | 类型 | 说明 | +| -------- | -------- | -------- | +| charging | boolean | 当前电池是否在充电中。 | +| level | number | 当前电池的电量,取值范围:0.00 - 1.00 。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md index aa52115fe4f88eea6c57b03ede1731d73c11cefd..cf8e51aa4d1b60ca58443507a460b53ae55387bc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @@ -1,6 +1,6 @@ # 屏幕亮度 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.brightness`](js-apis-brightness.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -23,11 +23,12 @@ getValue(Object): void **系统能力:** SystemCapability.PowerManager.DisplayPowerManager **参数:** + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| success | (data: [BrightnessResponse](#brightnessresponse)) => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | success返回值: @@ -35,6 +36,7 @@ success返回值: | -------- | -------- | -------- | | value | number | 屏幕亮度,取值为1-255之间的整数。 | + **示例:** ```js @@ -62,12 +64,13 @@ setValue(Object): void **系统能力:** SystemCapability.PowerManager.DisplayPowerManager **参数:** + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | value | number | 是 | 屏幕亮度,值为1-255之间的整数。
- 如果值小于等于0,系统按1处理。
- 如果值大于255,系统按255处理。
- 如果值为小数,系统将处理为整数。例如设置为8.1,系统按8处理。 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | **示例:** @@ -97,13 +100,14 @@ getMode(Object): void **系统能力:** SystemCapability.PowerManager.DisplayPowerManager **参数:** + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | - success返回值: +success返回值: | 参数名 | 类型 | 说明 | | -------- | -------- | -------- | @@ -138,10 +142,10 @@ setMode(Object): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| mode | number | 是 | 值为0或1
- 0为手动调节屏幕亮度
- 1为自动调节屏幕亮度 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| mode | number | 是 | 值为0或1
- 0为手动调节屏幕亮度。
- 1为自动调节屏幕亮度。 | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | **示例:** @@ -174,9 +178,9 @@ setKeepScreenOn(Object): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | keepScreenOn | boolean | 是 | 是否保持屏幕常亮。 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| success | () => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | **示例:** @@ -195,3 +199,17 @@ setKeepScreenOn(Object): void }, } ``` +## + +## BrightnessResponse + +| 名称 | 类型 | 说明 | +| -------- | -------- | -------- | +| value | number | 屏幕亮度,取值为1-255之间的整数。 | + +## BrightnessModeResponse + +| 名称 | 类型 | 说明 | +| -------- | -------- | -------- | +| mode | number | 值为0或1。
-0为手动调节屏幕亮度模式。
-1为手动调节屏幕亮度模式。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-timer.md b/zh-cn/application-dev/reference/apis/js-apis-timer.md index 8085456cf414c6b960aa2f6bc6a5ca003bc777f5..735737431ac22d891412701063b23ca254979d9b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-timer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-timer.md @@ -1,5 +1,10 @@ # 定时器 +本模块提供基础的定时器能力,支持按照指定的时间执行对应函数。 + +> **说明:** +> +> 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## setTimeout @@ -7,19 +12,24 @@ setTimeout(handler[,delay[,…args]]): number 设置一个定时器,该定时器在定时器到期后执行一个函数。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | handler | Function | 是 | 定时器到期后执行函数。 | - | delay | number | 否 | 延迟的毫秒数,函数的调用会在该延迟之后发生。如果省略该参数,delay取默认值0,意味着“马上”执行,或尽快执行。 | - | ...args | Array<any> | 否 | 附加参数,一旦定时器到期,它们会作为参数传递给handler。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| handler | Function | 是 | 定时器到期后执行函数。 | +| delay | number | 否 | 延迟的毫秒数,函数的调用会在该延迟之后发生。如果省略该参数,delay取默认值0,意味着“马上”执行,或尽快执行。 | +| ...args | Array<any> | 否 | 附加参数,一旦定时器到期,它们会作为参数传递给handler。 | + +**返回值:** -- 返回值 - | 类型 | 说明 | - | -------- | -------- | - | number | timeout定时器的ID。 | +| 类型 | 说明 | +| -------- | -------- | +| number | timeout定时器的ID。 | + +**示例:** -- 示例 ```js export default { setTimeOut() { @@ -37,12 +47,16 @@ clearTimeout(timeoutID: number): void 取消了先前通过调用setTimeout()建立的定时器。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | timeoutID | number | 是 | 要取消定时器的ID, 是由setTimeout()返回的。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| timeoutID | number | 是 | 要取消定时器的ID, 是由setTimeout()返回的。 | + +**示例:** -- 示例 ```js export default { clearTimeOut() { @@ -61,19 +75,24 @@ setInterval(handler[, delay[, ...args]]): number 重复调用一个函数,在每次调用之间具有固定的时间延迟。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | handler | Function | 是 | 要重复调用的函数。 | - | delay | number | 否 | 延迟的毫秒数(一秒等于1000毫秒),函数的调用会在该延迟之后发生。 | - | ...args | Array<any> | 否 | 附加参数,一旦定时器到期,他们会作为参数传递给handler。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full -- 返回值 - | 类型 | 说明 | - | -------- | -------- | - | number | intervalID重复定时器的ID。 | +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| handler | Function | 是 | 要重复调用的函数。 | +| delay | number | 否 | 延迟的毫秒数(一秒等于1000毫秒),函数的调用会在该延迟之后发生。 | +| ...args | Array<any> | 否 | 附加参数,一旦定时器到期,他们会作为参数传递给handler。 | + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| number | intervalID重复定时器的ID。 | + +**示例:** -- 示例 ```js export default { setInterval() { @@ -89,14 +108,18 @@ setInterval(handler[, delay[, ...args]]): number clearInterval(intervalID: number): void -可取消先前通过 setInterval() 设置的重复定时任务。 +可取消先前通过setInterval()设置的重复定时任务。 -- 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | intervalID | number | 是 | 要取消的重复定时器的ID,是由 setInterval() 返回的。 | +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| intervalID | number | 是 | 要取消的重复定时器的ID,是由 setInterval() 返回的。 | + +**示例:** -- 示例 ```js export default { clearInterval() { @@ -107,4 +130,3 @@ clearInterval(intervalID: number): void } } ``` -