Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
5757ec75
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,发现更多精彩内容 >>
未验证
提交
5757ec75
编写于
12月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!13007 modify time changelog
Merge pull request !13007 from wTong888/master
上级
a73884fe
98d874ac
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
266 addition
and
31 deletion
+266
-31
zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-time.md
...-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-time.md
+266
-0
zh-cn/release-notes/changelogs/OpenHarmony_4.0.1.1/changelogs-time.md
...e-notes/changelogs/OpenHarmony_4.0.1.1/changelogs-time.md
+0
-31
未找到文件。
zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-time.md
0 → 100644
浏览文件 @
5757ec75
# 时间时区子系统ChangeLog
## cl.time.1 接口异常抛出变更
时间时区子系统定时器接口异常抛出:202非系统应用异常和401参数无效异常。
**变更影响**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的异常处理,原有功能不受影响。
**关键接口/组件变更**
变更前:
-
接口异常抛出message,无错误码。
变更后:
-
接口异常抛出message和code,包括202非系统应用异常和401参数无效异常。
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ----------------- | ----------- | ------------------------------------------------------------ | -------- |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback<number>): void | 变更 |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise<number> | 变更 |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise<void> | 变更 |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise<void> | 变更 |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise<void> | 变更 |
**适配指导**
应用中调用systemTimer所有接口可参考下列代码进行异常捕获
createTimer callback形式调用:
**示例:**
```
js
export
default
{
systemTimer
()
{
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
};
try
{
systemTimer
.
createTimer
(
options
,
(
error
,
data
)
=>
{
if
(
error
)
{
//捕获权限否定异常
console
.
info
(
`Failed to create timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
}
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to create timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
createTimer promise形式调用:
**示例:**
```
js
export
default
{
systemTimer
()
{
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
};
try
{
systemTimer
.
createTimer
(
options
).
then
((
data
)
=>
{
console
.
info
(
`Succeeded in creating timer. Data:`
+
data
);
}).
catch
((
error
)
=>
{
//捕获权限否定异常
console
.
info
(
`Failed to create timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to create timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
startTimer callback形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
()
{
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
try
{
systemTimer
.
startTimer
(
timerId
,
triggerTime
,
(
error
)
=>
{
if
(
error
)
{
//捕获权限否定异常
console
.
error
(
`Failed to start timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
}
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to start timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
startTimer promise形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
(){
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
try
{
systemTimer
.
startTimer
(
timerId
,
triggerTime
).
then
((
data
)
=>
{
console
.
log
(
`Succeeded in startting timer. Data:`
+
data
);
}).
catch
((
error
)
=>
{
//捕获权限否定异常
console
.
info
(
`Failed to start timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to start timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
stopTimer callback形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
()
{
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
systemTimer
.
startTimer
(
timerId
,
triggerTime
);
try
{
systemTimer
.
stopTimer
(
timerId
,
triggerTime
,
(
error
)
=>
{
if
(
error
)
{
//捕获权限否定异常
console
.
error
(
`Failed to stop timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
}
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to stop timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
stopTimer promise形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
(){
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
systemTimer
.
startTimer
(
timerId
,
triggerTime
);
try
{
systemTimer
.
stopTimer
(
timerId
,
triggerTime
).
then
((
data
)
=>
{
console
.
log
(
`Succeeded in stop timer. Data:`
+
data
);
}).
catch
((
error
)
=>
{
//捕获权限否定异常
console
.
info
(
`Failed to stop timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to stop timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
destroyTimer callback形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
()
{
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
systemTimer
.
startTimer
(
timerId
,
triggerTime
);
systemTimer
.
stopTimer
(
timerId
);
try
{
systemTimer
.
destroyTimer
(
timerId
,
triggerTime
,
(
error
)
=>
{
if
(
error
)
{
//捕获权限否定异常
console
.
error
(
`Failed to destroy timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
}
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to destroy timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
destroyTimer promise形式调用:
**示例:**
```
js
export
default
{
async
systemTimer
(){
let
options
=
{
type
:
systemTimer
.
TIMER_TYPE_REALTIME
,
repeat
:
false
}
let
timerId
=
await
systemTimer
.
createTimer
(
options
);
let
triggerTime
=
new
Date
().
getTime
();
triggerTime
+=
3000
;
systemTimer
.
startTimer
(
timerId
,
triggerTime
);
systemTimer
.
stopTimer
(
timerId
);
try
{
systemTimer
.
destroyTimer
(
timerId
,
triggerTime
).
then
((
data
)
=>
{
console
.
log
(
`Succeeded in destroy timer. Data:`
+
data
);
}).
catch
((
error
)
=>
{
//捕获权限否定异常
console
.
info
(
`Failed to destroy timer. message:
${
error
.
message
}
, code:
${
error
.
code
}
`
);
});
}
catch
(
e
)
{
//捕获参数校验失败异常
console
.
info
(
`Failed to destroy timer. message:
${
e
.
message
}
, code:
${
e
.
code
}
`
);
}
}
}
```
zh-cn/release-notes/changelogs/OpenHarmony_4.0.1.1/changelogs-time.md
已删除
100644 → 0
浏览文件 @
a73884fe
# 时间时区子系统ChangeLog
## cl.time.1 接口异常抛出变更
时间时区子系统定时器接口异常抛出:202非系统应用异常和401参数无效异常。
**变更影响**
该接口变更前向兼容,基于此前版本开发的应用可继续使用接口,增加相应的异常处理,原有功能不受影响。
**关键接口/组件变更**
变更前:
-
接口异常抛出message,无错误码。
变更后:
-
接口异常抛出message和code,包括202非系统应用异常和401参数无效异常。
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
| ----------------- | ----------- | ------------------------------------------------------------ | -------- |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback<number>): void | 变更 |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise<number> | 变更 |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise<void> | 变更 |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise<void> | 变更 |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback<void>): void | 变更 |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise<void> | 变更 |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录