Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3983a30e
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,发现更多精彩内容 >>
未验证
提交
3983a30e
编写于
8月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!7936 【轻量级 PR】:update zh-cn/application-dev/reference/apis/js-apis-window.md.
Merge pull request !7936 from 葛亚芳/N/A
上级
27de13a2
430bda7d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
26 addition
and
27 deletion
+26
-27
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+26
-27
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
3983a30e
...
...
@@ -189,13 +189,14 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi
```
js
var
windowClass
=
null
;
let
promise
=
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
SubWindow created. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
,(
err
,
data
)
=>
{
if
(
err
.
code
){
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
return
;
}
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subWindow. Data:
'
+
JSON
.
stringify
(
data
));
});
```
## window.create<sup>7+</sup>
...
...
@@ -226,7 +227,7 @@ var windowClass = null;
let
promise
=
window
.
create
(
"
first
"
,
window
.
WindowType
.
TYPE_APP
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Su
bWindow created
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Su
cceeded in creating the subWindow
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the subWindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -255,11 +256,11 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Wi
var
windowClass
=
null
;
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to create the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to create the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
Window created
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in creating the window
. Data:
'
+
JSON
.
stringify
(
data
));
windowClass
.
resetSize
(
500
,
1000
);
});
```
...
...
@@ -294,9 +295,9 @@ var windowClass = null;
let
promise
=
window
.
create
(
this
.
context
,
"
alertWindow
"
,
window
.
WindowType
.
TYPE_SYSTEM_ALERT
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Window created
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in creating the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to create the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -321,11 +322,11 @@ find(id: string, callback: AsyncCallback<Window>): void
var
windowClass
=
null
;
window
.
find
(
"
alertWindow
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to find the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to find the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
windowClass
=
data
;
console
.
info
(
'
window found
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding the window
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -356,9 +357,9 @@ var windowClass = null;
let
promise
=
window
.
find
(
"
alertWindow
"
);
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
window found
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in finding the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to find the
W
indow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to find the
w
indow. Cause:
'
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -557,7 +558,7 @@ windowClass.hide((err, data) => {
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
window hidden
. data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
. data:
'
+
JSON
.
stringify
(
data
));
})
```
...
...
@@ -582,7 +583,7 @@ hide(): Promise<void>
```
js
let
promise
=
windowClass
.
hide
();
promise
.
then
((
data
)
=>
{
console
.
info
(
'
window hidden
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in hiding the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
...
...
@@ -714,7 +715,7 @@ windowClass.moveTo(300, 300, (err, data)=>{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Window moved
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in moving the window
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -745,7 +746,7 @@ moveTo(x: number, y: number): Promise<void>
```
js
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Window moved
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in moving the window
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
...
...
@@ -775,7 +776,7 @@ windowClass.resetSize(500, 1000, (err, data) => {
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Window size changed
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in changing the window size
. Data:
'
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -805,7 +806,7 @@ resetSize(width: number, height: number): Promise<void>
```
js
let
promise
=
windowClass
.
resetSize
(
500
,
1000
);
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Window size changed
. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in changing the window size
. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
});
...
...
@@ -2015,7 +2016,7 @@ promise.then((data)=> {
setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback
<
void
>
): void
设置窗口是否为隐私模式,使用callback异步回调。
设置窗口是否为隐私模式,使用callback异步回调。
设置为隐私模式的窗口,窗口内容无法被截屏或录屏。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
...
@@ -2044,7 +2045,7 @@ windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
setPrivacyMode(isPrivacyMode: boolean): Promise
<
void
>
设置窗口是否为隐私模式,使用Promise异步回调。
设置窗口是否为隐私模式,使用Promise异步回调。
设置为隐私模式的窗口,窗口内容无法被截屏或录屏。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
...
@@ -2132,5 +2133,3 @@ promise.then((data)=> {
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
});
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录