Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ca445312
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看板
未验证
提交
ca445312
编写于
7月 13, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 13, 2023
浏览文件
操作
浏览文件
下载
差异文件
!20609 【screenlock】示例规范整改
Merge pull request !20609 from wangdongqi/master
上级
057545cf
d45391d8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
163 addition
and
108 deletion
+163
-108
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md
+109
-108
zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.2/changelogs-screenlock.md
...s/changelogs/OpenHarmony_4.0.9.2/changelogs-screenlock.md
+54
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md
浏览文件 @
ca445312
...
...
@@ -9,7 +9,7 @@
## 导入模块
```
js
import
screen
l
ock
from
'
@ohos.screenLock
'
;
import
screen
L
ock
from
'
@ohos.screenLock
'
;
```
## EventType<sup>9+</sup>
...
...
@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock';
| eventType |
[
EventType
](
#eventtype9
)
| 是 | 系统事件类型。 |
| params | string | 是 | 系统事件参数。 |
## screen
l
ock.isLocked<sup>9+</sup>
## screen
L
ock.isLocked<sup>9+</sup>
isLocked(): boolean
...
...
@@ -69,10 +69,10 @@ isLocked(): boolean
**示例:**
```
js
let
isLocked
=
screen
l
ock
.
isLocked
();
let
isLocked
=
screen
L
ock
.
isLocked
();
```
## screen
l
ock.unlock<sup>9+</sup>
## screen
L
ock.unlock<sup>9+</sup>
unlock(callback: AsyncCallback
<
boolean
>
): void
...
...
@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback<boolean>): void
**示例:**
```
js
screenlock
.
unlock
((
err
,
data
)
=>
{
```
js
screenLock
.
unlock
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to unlock the screen, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to unlock the screen, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`
unlock the screen successfully
. result:
${
data
}
`
);
});
```
console
.
info
(
`
Succeeded in unlocking the screen
. result:
${
data
}
`
);
});
```
## screen
l
ock.unlock<sup>9+</sup>
## screen
L
ock.unlock<sup>9+</sup>
unlock(): Promise
<
boolean
>
...
...
@@ -134,15 +134,15 @@ unlock(): Promise<boolean>
**示例:**
```
js
screenl
ock
.
unlock
().
then
((
data
)
=>
{
console
.
info
(
`
unlock the screen successfully
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to unlock the screen,
becaus
e:
${
err
.
message
}
`
);
});
```
```
js
screenL
ock
.
unlock
().
then
((
data
)
=>
{
console
.
info
(
`
Succeeded in unlocking the screen
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to unlock the screen,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
});
```
## screen
l
ock.lock<sup>9+</sup>
## screen
L
ock.lock<sup>9+</sup>
lock(callback: AsyncCallback
<
boolean
>
): void
...
...
@@ -170,17 +170,17 @@ lock(callback: AsyncCallback<boolean>): void
**示例:**
```
js
screenlock
.
lock
((
err
,
data
)
=>
{
```
js
screenLock
.
lock
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to lock the screen, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to lock the screen, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`
lock the screen successfully
. result:
${
data
}
`
);
});
```
console
.
info
(
`
Succeeded in locking the screen
. result:
${
data
}
`
);
});
```
## screen
l
ock.lock<sup>9+</sup>
## screen
L
ock.lock<sup>9+</sup>
lock(): Promise
<
boolean
>
...
...
@@ -208,15 +208,15 @@ lock(): Promise<boolean>
**示例:**
```
js
screenl
ock
.
lock
().
then
((
data
)
=>
{
console
.
info
(
`
lock the screen successfully
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to lock the screen,
becaus
e:
${
err
.
message
}
`
);
});
```
```
js
screenL
ock
.
lock
().
then
((
data
)
=>
{
console
.
info
(
`
Succeeded in locking the screen
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to lock the screen,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
});
```
## screen
l
ock.onSystemEvent<sup>9+</sup>
## screen
L
ock.onSystemEvent<sup>9+</sup>
onSystemEvent(callback: Callback
<
SystemEvent
>
): boolean
...
...
@@ -250,17 +250,17 @@ onSystemEvent(callback: Callback<SystemEvent>): boolean
**示例:**
```
js
try
{
let
isSuccess
=
screen
l
ock
.
onSystemEvent
((
event
)
=>
{
console
.
log
(
`Register the system event which related to screenlock successfully
. eventType:
${
event
.
eventType
}
`
)
```
js
try
{
let
isSuccess
=
screen
L
ock
.
onSystemEvent
((
event
)
=>
{
console
.
log
(
`Succeeded in Registering the system event which related to screenlock
. eventType:
${
event
.
eventType
}
`
)
});
}
catch
(
err
)
{
console
.
error
(
`Failed to register the system event which related to screenlock,
becaus
e:
${
err
.
message
}
`
)
}
```
}
catch
(
err
)
{
console
.
error
(
`Failed to register the system event which related to screenlock,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
)
}
```
## screen
l
ock.sendScreenLockEvent<sup>9+</sup>
## screen
L
ock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback
<
boolean
>
): void
...
...
@@ -290,17 +290,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<
**示例:**
```
js
screenl
ock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
,
(
err
,
result
)
=>
{
```
js
screenL
ock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to send screenlock event, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to send screenlock event, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`S
end screenlock event successfully
. result:
${
result
}
`
);
});
```
console
.
info
(
`S
ucceeded in Sending screenlock event
. result:
${
result
}
`
);
});
```
## screen
l
ock.sendScreenLockEvent<sup>9+</sup>
## screen
L
ock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise
<
boolean
>
...
...
@@ -335,15 +335,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise<boolean>
**示例:**
```
js
screenl
ock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
).
then
((
result
)
=>
{
console
.
info
(
`S
end screenlock event successfully
. result:
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to send screenlock event,
becaus
e:
${
err
.
message
}
`
);
});
```
```
js
screenL
ock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
).
then
((
result
)
=>
{
console
.
info
(
`S
ucceeded in Sending screenlock event
. result:
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to send screenlock event,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
});
```
## screen
l
ock.isScreenLocked<sup>(deprecated)</sup>
## screen
L
ock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(callback: AsyncCallback
<
boolean
>
): void
...
...
@@ -363,17 +363,17 @@ isScreenLocked(callback: AsyncCallback<boolean>): void
**示例:**
```
js
screenl
ock
.
isScreenLocked
((
err
,
data
)
=>
{
```
js
screenL
ock
.
isScreenLocked
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain whether the screen is locked, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to obtain whether the screen is locked, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`
Obtain whether the screen is locked successfully
. result:
${
data
}
`
);
});
```
console
.
info
(
`
Succeeded in Obtaining whether the screen is locked
. result:
${
data
}
`
);
});
```
## screen
l
ock.isScreenLocked<sup>(deprecated)</sup>
## screen
L
ock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(): Promise
<
boolean
>
...
...
@@ -393,15 +393,15 @@ isScreenLocked(): Promise<boolean>
**示例:**
```
js
screenl
ock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
info
(
`
Obtain whether the screen is locked successfully
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to obtain whether the screen is locked,
becaus
e:
${
err
.
message
}
`
);
});
```
```
js
screenL
ock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
info
(
`
Succeeded in Obtaining whether the screen is locked
. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to obtain whether the screen is locked,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
});
```
## screen
l
ock.isSecureMode<sup>(deprecated)</sup>
## screen
L
ock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(callback: AsyncCallback
<
boolean
>
): void
...
...
@@ -421,17 +421,17 @@ isSecureMode(callback: AsyncCallback<boolean>): void
**示例:**
```
js
screenl
ock
.
isSecureMode
((
err
,
data
)
=>
{
```
js
screenL
ock
.
isSecureMode
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to obtain whether the device is in secure mode, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to obtain whether the device is in secure mode, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`
Obtain whether the device is in secure mode successfully
. result:
${
data
}
`
);
});
```
console
.
info
(
`
Succeeded in Obtaining whether the device is in secure mode
. result:
${
data
}
`
);
});
```
## screen
l
ock.isSecureMode<sup>(deprecated)</sup>
## screen
L
ock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(): Promise
<
boolean
>
...
...
@@ -451,14 +451,15 @@ isSecureMode(): Promise<boolean>
**示例:**
```
js
screenlock
.
isSecureMode
().
then
((
data
)
=>
{
console
.
info
(
`Obtain whether the device is in secure mode successfully. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to obtain whether the device is in secure mode, because:
${
err
.
message
}
`
);
});
```
## screenlock.unlockScreen<sup>(deprecated)</sup>
```
js
screenLock
.
isSecureMode
().
then
((
data
)
=>
{
console
.
info
(
`Succeeded in Obtaining whether the device is in secure mode. result:
${
data
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to obtain whether the device is in secure mode, Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(callback: AsyncCallback
<
void
>
): void
...
...
@@ -478,17 +479,17 @@ unlockScreen(callback: AsyncCallback<void>): void
**示例:**
```
js
screenl
ock
.
unlockScreen
((
err
)
=>
{
```
js
screenL
ock
.
unlockScreen
((
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to unlock the screen, becaus
e:
${
err
.
message
}
`
);
return
;
console
.
error
(
`Failed to unlock the screen, Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
unlock the screen successfully.
'
);
});
```
console
.
info
(
`Succeeded unlocking the screen.`
);
});
```
## screen
l
ock.unlockScreen<sup>(deprecated)</sup>
## screen
L
ock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise
<
void
>
...
...
@@ -508,10 +509,10 @@ unlockScreen(): Promise<void>
**示例:**
```
js
screenl
ock
.
unlockScreen
().
then
(()
=>
{
console
.
info
(
'
unlock the screen successfully
.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to unlock the screen,
becaus
e:
${
err
.
message
}
`
);
});
```
```
js
screenL
ock
.
unlockScreen
().
then
(()
=>
{
console
.
info
(
'
Succeeded unlocking the screen
.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to unlock the screen,
Code:
${
err
.
code
}
, messag
e:
${
err
.
message
}
`
);
});
```
zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.2/changelogs-screenlock.md
0 → 100644
浏览文件 @
ca445312
# 主题框架子系统锁屏管理ChangeLog
## cl.screenlock.1 代码实例名称变更
锁屏管理的包名为'@ohos.screenLock',在导入时,使用的代码实例应为screenLock,而不是screenlock。
**变更影响**
无。
**关键的接口/组件变更**
修改前的接口调用:
```
js
screenlock
.
isLocked
();
screenlock
.
unlock
();
screenlock
.
lock
();
screenlock
.
onSystemEvent
(
event
=>
{});
screenlock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
);
screenlock
.
isScreenLocked
()
screenlock
.
isSecureMode
();
screenlock
.
unlockScreen
();
```
修改后的接口调用:
```
js
screenLock
.
isLocked
();
screenLock
.
unlock
();
screenLock
.
lock
();
screenLock
.
onSystemEvent
(
event
=>
{});
screenLock
.
sendScreenLockEvent
(
'
unlockScreenResult
'
,
0
);
screenLock
.
isScreenLocked
()
screenLock
.
isSecureMode
();
screenLock
.
unlockScreen
();
```
**适配指导**
导入时使用screenLock,例如::
修改前
```
js
import
screenlock
from
'
@ohos.screenLock
'
;
```
修改后
```
js
import
screenLock
from
'
@ohos.screenLock
'
;
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录