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

!11605 时间时区资料整改

Merge pull request !11605 from wTong888/master
...@@ -14,7 +14,7 @@ import systemTimer from '@ohos.systemTimer'; ...@@ -14,7 +14,7 @@ import systemTimer from '@ohos.systemTimer';
``` ```
## systemTime.createTimer ## systemTimer.createTimer
createTimer(options: TimerOptions, callback: AsyncCallback<number>): void createTimer(options: TimerOptions, callback: AsyncCallback<number>): void
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
``` ```
## systemTime.createTimer ## systemTimer.createTimer
createTimer(options: TimerOptions): Promise<number> createTimer(options: TimerOptions): Promise<number>
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
``` ```
## systemTime.startTimer ## systemTimer.startTimer
startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void
...@@ -106,7 +106,7 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void&g ...@@ -106,7 +106,7 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void&g
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ------------------------------------------------------------ | | ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 | | timer | number | 是 | 定时器的ID。 |
| triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 | | triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 |
...@@ -114,12 +114,12 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void&g ...@@ -114,12 +114,12 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void&g
```js ```js
export default { export default {
systemTimer () { async systemTimer () {
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime, (error, data) => { systemTimer.startTimer(timerId, triggerTime, (error, data) => {
...@@ -132,8 +132,8 @@ export default { ...@@ -132,8 +132,8 @@ export default {
} }
} }
``` ```
## systemTime.startTimer ## systemTimer.startTimer
startTimer(timer: number, triggerTime: number): Promise<void> startTimer(timer: number, triggerTime: number): Promise<void>
...@@ -153,12 +153,12 @@ startTimer(timer: number, triggerTime: number): Promise<void> ...@@ -153,12 +153,12 @@ startTimer(timer: number, triggerTime: number): Promise<void>
```js ```js
export default { export default {
systemTimer (){ async systemTimer (){
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime).then((data) => { systemTimer.startTimer(timerId, triggerTime).then((data) => {
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
``` ```
## systemTime.stopTimer ## systemTimer.stopTimer
stopTimer(timer: number, callback: AsyncCallback<void>): void stopTimer(timer: number, callback: AsyncCallback<void>): void
...@@ -189,16 +189,16 @@ stopTimer(timer: number, callback: AsyncCallback<void>): void ...@@ -189,16 +189,16 @@ stopTimer(timer: number, callback: AsyncCallback<void>): void
```js ```js
export default { export default {
systemTimer () { async systemTimer () {
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime) systemTimer.startTimer(timerId, triggerTime)
systemTimer.stoptTimer(timerId, (error, data) => { systemTimer.stopTimer(timerId, (error, data) => {
if (error) { if (error) {
console.error(`failed to systemTime.startTimer ` + JSON.stringify(error)); console.error(`failed to systemTime.startTimer ` + JSON.stringify(error));
return; return;
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
``` ```
## systemTime.stopTimer ## systemTimer.stopTimer
stopTimer(timer: number): Promise<void> stopTimer(timer: number): Promise<void>
...@@ -222,22 +222,22 @@ stopTimer(timer: number): Promise<void> ...@@ -222,22 +222,22 @@ stopTimer(timer: number): Promise<void>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ | | ------ | ------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 | | timer | number | 是 | 定时器的ID。 |
**示例:** **示例:**
```js ```js
export default { export default {
systemTimer (){ async systemTimer (){
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime) systemTimer.startTimer(timerId, triggerTime)
systemTimer.stoptTimer(timerId).then((data) => { systemTimer.stopTimer(timerId).then((data) => {
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data)); console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error)); console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error));
...@@ -247,7 +247,7 @@ export default { ...@@ -247,7 +247,7 @@ export default {
``` ```
## systemTime.destroyTimer ## systemTimer.destroyTimer
destroyTimer(timer: number, callback: AsyncCallback<void>): void destroyTimer(timer: number, callback: AsyncCallback<void>): void
...@@ -265,12 +265,12 @@ destroyTimer(timer: number, callback: AsyncCallback<void>): void ...@@ -265,12 +265,12 @@ destroyTimer(timer: number, callback: AsyncCallback<void>): void
```js ```js
export default { export default {
systemTimer () { async systemTimer () {
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime) systemTimer.startTimer(timerId, triggerTime)
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
``` ```
## systemTime.destroyTimer ## systemTimer.destroyTimer
destroyTimer(timer: number): Promise<void> destroyTimer(timer: number): Promise<void>
...@@ -305,12 +305,12 @@ destroyTimer(timer: number): Promise<void> ...@@ -305,12 +305,12 @@ destroyTimer(timer: number): Promise<void>
```js ```js
export default { export default {
systemTimer (){ async systemTimer (){
var options = { var options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false repeat:false
} }
let timerId = systemTimer.createTimer(options) let timerId = await systemTimer.createTimer(options)
let triggerTime = new Date().getTime() let triggerTime = new Date().getTime()
triggerTime += 3000 triggerTime += 3000
systemTimer.startTimer(timerId, triggerTime) systemTimer.startTimer(timerId, triggerTime)
...@@ -323,7 +323,7 @@ export default { ...@@ -323,7 +323,7 @@ export default {
} }
} }
``` ```
## TimerOptions ## TimerOptions
createTimer的初始化选项。 createTimer的初始化选项。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册