Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
1d381a40
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看板
提交
1d381a40
编写于
7月 12, 2023
作者:
W
wangdongqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Signed-off-by: wangdongqi <wangdongqi2@huawei.com>
Changes to be committed:
上级
f46cd827
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
109 addition
and
108 deletion
+109
-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/application-dev/reference/apis/js-apis-screen-lock.md
浏览文件 @
1d381a40
...
...
@@ -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
...
...
@@ -168,17 +168,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
>
...
...
@@ -204,15 +204,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
...
...
@@ -244,17 +244,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
...
...
@@ -282,17 +282,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
>
...
...
@@ -325,15 +325,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
...
...
@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback<boolean>): void
**示例:**
```
js
screenlock
.
isScreenLocked
((
err
,
data
)
=>
{
```
js
screenLock
.
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
>
...
...
@@ -383,15 +383,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
...
...
@@ -411,17 +411,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
>
...
...
@@ -441,14 +441,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
...
...
@@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback<void>): void
**示例:**
```
js
screenlock
.
unlockScreen
((
err
)
=>
{
```
js
screenLock
.
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
>
...
...
@@ -498,10 +499,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
}
`
);
});
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录