Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e690296e
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
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,发现更多精彩内容 >>
未验证
提交
e690296e
编写于
11月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11605 时间时区资料整改
Merge pull request !11605 from wTong888/master
上级
0a6647f5
abd7ee6d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
26 deletion
+26
-26
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
+26
-26
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
浏览文件 @
e690296e
...
@@ -14,7 +14,7 @@ import systemTimer from '@ohos.systemTimer';
...
@@ -14,7 +14,7 @@ import systemTimer from '@ohos.systemTimer';
```
```
## systemTime.createTimer
## systemTime
r
.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
## systemTime
r
.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
## systemTime
r
.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
## systemTime
r
.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
## systemTime
r
.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
.
stop
t
Timer
(
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
## systemTime
r
.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
.
stop
t
Timer
(
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
## systemTime
r
.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
## systemTime
r
.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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录