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

!11605 时间时区资料整改

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