Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3eca0ebd
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
3eca0ebd
编写于
11月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11407 3.2Beta3分支:sample的下线及部分修改同步
Merge pull request !11407 from 葛亚芳/OpenHarmony-3.2-Beta3
上级
6d8e67bf
390470d4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
186 addition
and
200 deletion
+186
-200
zh-cn/application-dev/ability/stage-ability.md
zh-cn/application-dev/ability/stage-ability.md
+1
-5
zh-cn/application-dev/ability/stage-call.md
zh-cn/application-dev/ability/stage-call.md
+0
-4
zh-cn/application-dev/notification/notification-guidelines.md
...n/application-dev/notification/notification-guidelines.md
+0
-2
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+119
-123
zh-cn/application-dev/windowmanager/application-window-fa.md
zh-cn/application-dev/windowmanager/application-window-fa.md
+22
-22
zh-cn/application-dev/windowmanager/application-window-stage.md
...application-dev/windowmanager/application-window-stage.md
+34
-34
zh-cn/application-dev/windowmanager/system-window-stage.md
zh-cn/application-dev/windowmanager/system-window-stage.md
+10
-10
未找到文件。
zh-cn/application-dev/ability/stage-ability.md
浏览文件 @
3eca0ebd
...
@@ -320,8 +320,4 @@ struct Index {
...
@@ -320,8 +320,4 @@ struct Index {
}
}
}
}
}
}
```
```
\ No newline at end of file
## 相关实例
针对Stage模型Ability开发,有以下相关示例可供参考:
-
[
`StageCallAbility`:StageCallAbility的创建与使用(ArkTS)(API9)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/ability/StageCallAbility
)
zh-cn/application-dev/ability/stage-call.md
浏览文件 @
3eca0ebd
...
@@ -281,7 +281,3 @@ releaseCall() {
...
@@ -281,7 +281,3 @@ releaseCall() {
}
}
}
}
```
```
## 相关实例
针对Stage模型本地Call功能开发,有以下相关实例可供参考:
-
[
`StageCallAbility`:StageCallAbility的创建与使用(ArkTS)(API9)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/ability/StageCallAbility
)
zh-cn/application-dev/notification/notification-guidelines.md
浏览文件 @
3eca0ebd
...
@@ -263,5 +263,3 @@ Notification.cancel(1, "label", cancelCallback)
...
@@ -263,5 +263,3 @@ Notification.cancel(1, "label", cancelCallback)
针对通知开发,有以下相关可供参考:
针对通知开发,有以下相关可供参考:
-
[
`Notification:`订阅、发送通知(ArkTS)(API9)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/Notification
)
-
[
`Notification:`订阅、发送通知(ArkTS)(API9)(Full SDK)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/Notification
)
-
[
`Notification`:通知(ArkTS)(API8)
](
https://gitee.com/openharmony/applications_app_samples/tree/master/common/Notification
)
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
3eca0ebd
...
@@ -632,7 +632,7 @@ display.getDefaultDisplay((err, data) => {
...
@@ -632,7 +632,7 @@ display.getDefaultDisplay((err, data) => {
return
;
return
;
}
}
displayClass
=
data
;
displayClass
=
data
;
window
.
minimizeAll
(
displayClass
.
id
,
(
err
,
data
)
=>
{
window
.
minimizeAll
(
displayClass
.
id
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -676,7 +676,7 @@ display.getDefaultDisplay((err, data) => {
...
@@ -676,7 +676,7 @@ display.getDefaultDisplay((err, data) => {
}
}
displayClass
=
data
;
displayClass
=
data
;
let
promise
=
window
.
minimizeAll
(
displayClass
.
id
);
let
promise
=
window
.
minimizeAll
(
displayClass
.
id
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
...
@@ -702,7 +702,7 @@ toggleShownStateForAllAppWindows(callback: AsyncCallback<void>): void
...
@@ -702,7 +702,7 @@ toggleShownStateForAllAppWindows(callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
window
.
toggleShownStateForAllAppWindows
((
err
,
data
)
=>
{
window
.
toggleShownStateForAllAppWindows
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to toggle shown state for all app windows. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to toggle shown state for all app windows. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
...
@@ -730,8 +730,8 @@ toggleShownStateForAllAppWindows(): Promise<void>
...
@@ -730,8 +730,8 @@ toggleShownStateForAllAppWindows(): Promise<void>
```
js
```
js
let
promise
=
window
.
toggleShownStateForAllAppWindows
();
let
promise
=
window
.
toggleShownStateForAllAppWindows
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in toggling shown state for all app windows.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in toggling shown state for all app windows.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to toggle shown state for all app windows. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to toggle shown state for all app windows. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -756,8 +756,8 @@ setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback<void>)
...
@@ -756,8 +756,8 @@ setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback<void>)
**示例:**
**示例:**
```
js
```
js
window
.
setWindowLayoutMode
(
window
.
WindowLayoutMode
.
WINDOW_LAYOUT_MODE_CASCADE
,
(
data
)
=>
{
window
.
setWindowLayoutMode
(
window
.
WindowLayoutMode
.
WINDOW_LAYOUT_MODE_CASCADE
,
()
=>
{
console
.
info
(
'
Succeeded in setting window layout mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting window layout mode.
'
);
});
});
```
```
...
@@ -786,8 +786,8 @@ setWindowLayoutMode(mode: WindowLayoutMode): Promise<void>
...
@@ -786,8 +786,8 @@ setWindowLayoutMode(mode: WindowLayoutMode): Promise<void>
```
js
```
js
let
promise
=
window
.
setWindowLayoutMode
(
window
.
WindowLayoutMode
.
WINDOW_LAYOUT_MODE_CASCADE
);
let
promise
=
window
.
setWindowLayoutMode
(
window
.
WindowLayoutMode
.
WINDOW_LAYOUT_MODE_CASCADE
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting window layout mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting window layout mode.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set window layout mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set window layout mode. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -866,12 +866,12 @@ hide (callback: AsyncCallback<void>): void
...
@@ -866,12 +866,12 @@ hide (callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
hide
((
err
,
data
)
=>
{
windowClass
.
hide
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in hiding the window.
data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in hiding the window.
'
);
})
})
```
```
...
@@ -895,8 +895,8 @@ hide(): Promise<void>
...
@@ -895,8 +895,8 @@ hide(): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
hide
();
let
promise
=
windowClass
.
hide
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in hiding the window.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -921,12 +921,12 @@ hideWithAnimation(callback: AsyncCallback<void>): void
...
@@ -921,12 +921,12 @@ hideWithAnimation(callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
hideWithAnimation
((
err
,
data
)
=>
{
windowClass
.
hideWithAnimation
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in hiding the window with animation.
data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in hiding the window with animation.
'
);
})
})
```
```
...
@@ -950,8 +950,8 @@ hideWithAnimation(): Promise<void>
...
@@ -950,8 +950,8 @@ hideWithAnimation(): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
hideWithAnimation
();
let
promise
=
windowClass
.
hideWithAnimation
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in hiding the window with animation.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in hiding the window with animation.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -974,12 +974,12 @@ show(callback: AsyncCallback<void>): void
...
@@ -974,12 +974,12 @@ show(callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
show
((
err
,
data
)
=>
{
windowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
})
})
```
```
...
@@ -1001,8 +1001,8 @@ show(): Promise<void>
...
@@ -1001,8 +1001,8 @@ show(): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
show
();
let
promise
=
windowClass
.
show
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -1027,12 +1027,12 @@ showWithAnimation(callback: AsyncCallback<void>): void
...
@@ -1027,12 +1027,12 @@ showWithAnimation(callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
showWithAnimation
((
err
,
data
)
=>
{
windowClass
.
showWithAnimation
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window with animation.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window with animation.
'
);
})
})
```
```
...
@@ -1056,8 +1056,8 @@ showWithAnimation(): Promise<void>
...
@@ -1056,8 +1056,8 @@ showWithAnimation(): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
showWithAnimation
();
let
promise
=
windowClass
.
showWithAnimation
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in showing the window with animation.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window with animation.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -1080,12 +1080,12 @@ destroy(callback: AsyncCallback<void>): void
...
@@ -1080,12 +1080,12 @@ destroy(callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
destroy
((
err
,
data
)
=>
{
windowClass
.
destroy
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in destroying the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in destroying the window.
'
);
})
})
```
```
...
@@ -1107,8 +1107,8 @@ destroy(): Promise<void>
...
@@ -1107,8 +1107,8 @@ destroy(): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
destroy
();
let
promise
=
windowClass
.
destroy
();
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in destroying the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in destroying the window.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -1133,12 +1133,12 @@ moveTo(x: number, y: number, callback: AsyncCallback<void>): void
...
@@ -1133,12 +1133,12 @@ moveTo(x: number, y: number, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
moveTo
(
300
,
300
,
(
err
,
data
)
=>
{
windowClass
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
});
});
```
```
...
@@ -1168,8 +1168,8 @@ moveTo(x: number, y: number): Promise<void>
...
@@ -1168,8 +1168,8 @@ moveTo(x: number, y: number): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
let
promise
=
windowClass
.
moveTo
(
300
,
300
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -1198,12 +1198,12 @@ resetSize(width: number, height: number, callback: AsyncCallback<void>): v
...
@@ -1198,12 +1198,12 @@ resetSize(width: number, height: number, callback: AsyncCallback<void>): v
**示例:**
**示例:**
```
js
```
js
windowClass
.
resetSize
(
500
,
1000
,
(
err
,
data
)
=>
{
windowClass
.
resetSize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
});
});
```
```
...
@@ -1236,8 +1236,8 @@ resetSize(width: number, height: number): Promise<void>
...
@@ -1236,8 +1236,8 @@ resetSize(width: number, height: number): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
resetSize
(
500
,
1000
);
let
promise
=
windowClass
.
resetSize
(
500
,
1000
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1268,12 +1268,12 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void
...
@@ -1268,12 +1268,12 @@ setWindowType(type: WindowType, callback: AsyncCallback<void>): void
```
js
```
js
let
type
=
window
.
WindowType
.
TYPE_APP
;
let
type
=
window
.
WindowType
.
TYPE_APP
;
windowClass
.
setWindowType
(
type
,
(
err
,
data
)
=>
{
windowClass
.
setWindowType
(
type
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window type. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window type. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window type.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window type.
'
);
});
});
```
```
...
@@ -1308,8 +1308,8 @@ setWindowType(type: WindowType): Promise<void>
...
@@ -1308,8 +1308,8 @@ setWindowType(type: WindowType): Promise<void>
```
js
```
js
let
type
=
window
.
WindowType
.
TYPE_APP
;
let
type
=
window
.
WindowType
.
TYPE_APP
;
let
promise
=
windowClass
.
setWindowType
(
type
);
let
promise
=
windowClass
.
setWindowType
(
type
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window type.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window type.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window type. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window type. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1370,7 +1370,7 @@ promise.then((data)=> {
...
@@ -1370,7 +1370,7 @@ promise.then((data)=> {
getAvoidArea(type:
[
AvoidAreaType
](
#avoidareatype7
)
, callback: AsyncCallback
<
[AvoidArea](#avoidarea7)
>
): void
getAvoidArea(type:
[
AvoidAreaType
](
#avoidareatype7
)
, callback: AsyncCallback
<
[AvoidArea](#avoidarea7)
>
): void
获取窗口内容规避的区域,如系统
的系统栏区域、凹凸
区域。使用callback异步回调。
获取窗口内容规避的区域,如系统
栏区域、刘海屏区域、手势区域、软键盘区域等与窗口内容重叠时,需要窗口内容避让的
区域。使用callback异步回调。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
@@ -1398,7 +1398,7 @@ windowClass.getAvoidArea(type, (err, data) => {
...
@@ -1398,7 +1398,7 @@ windowClass.getAvoidArea(type, (err, data) => {
getAvoidArea(type:
[
AvoidAreaType
](
#avoidareatype7
)
): Promise
<
[AvoidArea](#avoidarea7)
>
getAvoidArea(type:
[
AvoidAreaType
](
#avoidareatype7
)
): Promise
<
[AvoidArea](#avoidarea7)
>
获取窗口内容规避的区域,如系统
的系统栏区域、凹凸
区域。使用Promise异步回调。
获取窗口内容规避的区域,如系统
栏区域、刘海屏区域、手势区域、软键盘区域等与窗口内容重叠时,需要窗口内容避让的
区域。使用Promise异步回调。
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
**系统能力:**
SystemCapability.WindowManager.WindowManager.Core
...
@@ -1445,12 +1445,12 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void
...
@@ -1445,12 +1445,12 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void
```
js
```
js
let
isFullScreen
=
true
;
let
isFullScreen
=
true
;
windowClass
.
setFullScreen
(
isFullScreen
,
(
err
,
data
)
=>
{
windowClass
.
setFullScreen
(
isFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in enabling the full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in enabling the full-screen mode.
'
);
});
});
```
```
...
@@ -1479,8 +1479,8 @@ setFullScreen(isFullScreen: boolean): Promise<void>
...
@@ -1479,8 +1479,8 @@ setFullScreen(isFullScreen: boolean): Promise<void>
```
js
```
js
let
isFullScreen
=
true
;
let
isFullScreen
=
true
;
let
promise
=
windowClass
.
setFullScreen
(
isFullScreen
);
let
promise
=
windowClass
.
setFullScreen
(
isFullScreen
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in enabling the full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in enabling the full-screen mode.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1505,12 +1505,12 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void
...
@@ -1505,12 +1505,12 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void
```
js
```
js
let
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
,
data
)
=>
{
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
'
);
});
});
```
```
...
@@ -1539,8 +1539,8 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>
...
@@ -1539,8 +1539,8 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>
```
js
```
js
let
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
let
promise
=
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
);
let
promise
=
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1566,12 +1566,12 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallbac
...
@@ -1566,12 +1566,12 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallbac
```
js
```
js
// 此处以不显示导航栏、状态栏为例
// 此处以不显示导航栏、状态栏为例
let
names
=
[];
let
names
=
[];
windowClass
.
setSystemBarEnable
(
names
,
(
err
,
data
)
=>
{
windowClass
.
setSystemBarEnable
(
names
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar to be invisible.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar to be invisible.
'
);
});
});
```
```
...
@@ -1601,8 +1601,8 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
...
@@ -1601,8 +1601,8 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>
// 此处以不显示导航栏、状态栏为例
// 此处以不显示导航栏、状态栏为例
let
names
=
[];
let
names
=
[];
let
promise
=
windowClass
.
setSystemBarEnable
(
names
);
let
promise
=
windowClass
.
setSystemBarEnable
(
names
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the system bar to be invisible.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar to be invisible.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1633,12 +1633,12 @@ let SystemBarProperties={
...
@@ -1633,12 +1633,12 @@ let SystemBarProperties={
statusBarContentColor
:
'
#ffffff
'
,
statusBarContentColor
:
'
#ffffff
'
,
navigationBarContentColor
:
'
#00ffff
'
navigationBarContentColor
:
'
#00ffff
'
};
};
windowClass
.
setSystemBarProperties
(
SystemBarProperties
,
(
err
,
data
)
=>
{
windowClass
.
setSystemBarProperties
(
SystemBarProperties
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar properties.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar properties.
'
);
});
});
```
```
...
@@ -1673,8 +1673,8 @@ let SystemBarProperties={
...
@@ -1673,8 +1673,8 @@ let SystemBarProperties={
navigationBarContentColor
:
'
#00ffff
'
navigationBarContentColor
:
'
#00ffff
'
};
};
let
promise
=
windowClass
.
setSystemBarProperties
(
SystemBarProperties
);
let
promise
=
windowClass
.
setSystemBarProperties
(
SystemBarProperties
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the system bar properties.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar properties.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1699,12 +1699,12 @@ setPreferredOrientation(orientation: Orientation, callback: AsyncCallback<voi
...
@@ -1699,12 +1699,12 @@ setPreferredOrientation(orientation: Orientation, callback: AsyncCallback<voi
```
js
```
js
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
windowClass
.
setPreferredOrientation
(
orientation
,
(
err
,
data
)
=>
{
windowClass
.
setPreferredOrientation
(
orientation
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set window orientation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set window orientation. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting window orientation.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting window orientation.
'
);
});
});
```
```
...
@@ -1733,8 +1733,8 @@ setPreferredOrientation(orientation: Orientation): Promise<void>
...
@@ -1733,8 +1733,8 @@ setPreferredOrientation(orientation: Orientation): Promise<void>
```
js
```
js
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
orientation
=
window
.
Orientation
.
AUTO_ROTATION
;
let
promise
=
windowClass
.
setPreferredOrientation
(
orientation
);
let
promise
=
windowClass
.
setPreferredOrientation
(
orientation
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window orientation.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window orientation.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window orientation. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window orientation. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1758,12 +1758,12 @@ loadContent(path: string, callback: AsyncCallback<void>): void
...
@@ -1758,12 +1758,12 @@ loadContent(path: string, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
loadContent
(
'
pages/page2/page2
'
,
(
err
,
data
)
=>
{
windowClass
.
loadContent
(
'
pages/page2/page2
'
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
```
```
...
@@ -1791,8 +1791,8 @@ loadContent(path: string): Promise<void>
...
@@ -1791,8 +1791,8 @@ loadContent(path: string): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
loadContent
(
'
pages/page2/page2
'
);
let
promise
=
windowClass
.
loadContent
(
'
pages/page2/page2
'
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -1824,12 +1824,12 @@ class myAbility extends Ability {
...
@@ -1824,12 +1824,12 @@ class myAbility extends Ability {
this
.
storage
=
new
LocalStorage
();
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
}
}
}
}
...
@@ -1867,11 +1867,9 @@ class myAbility extends Ability {
...
@@ -1867,11 +1867,9 @@ class myAbility extends Ability {
this
.
storage
=
new
LocalStorage
();
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in loading the content.
'
);
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -2298,12 +2296,12 @@ class TestRemoteObject extends rpc.RemoteObject {
...
@@ -2298,12 +2296,12 @@ class TestRemoteObject extends rpc.RemoteObject {
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
console
.
info
(
'
Dialog Window Need Destroy.
'
);
console
.
info
(
'
Dialog Window Need Destroy.
'
);
},
(
err
,
data
)
=>
{
},
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in binding dialog target.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in binding dialog target.
'
);
});
});
```
```
...
@@ -2356,8 +2354,8 @@ let token = new TestRemoteObject('testObject');
...
@@ -2356,8 +2354,8 @@ let token = new TestRemoteObject('testObject');
let
promise
=
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
let
promise
=
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
console
.
info
(
'
Dialog Window Need Destroy.
'
);
console
.
info
(
'
Dialog Window Need Destroy.
'
);
});
});
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in binding dialog target.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in binding dialog target.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2432,12 +2430,12 @@ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback<void>): void
...
@@ -2432,12 +2430,12 @@ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
setColorSpace
(
window
.
ColorSpace
.
WIDE_GAMUT
,
(
err
,
data
)
=>
{
windowClass
.
setColorSpace
(
window
.
ColorSpace
.
WIDE_GAMUT
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting window colorspace.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting window colorspace.
'
);
})
})
```
```
...
@@ -2465,8 +2463,8 @@ setColorSpace(colorSpace:ColorSpace): Promise<void>
...
@@ -2465,8 +2463,8 @@ setColorSpace(colorSpace:ColorSpace): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
setColorSpace
(
window
.
ColorSpace
.
WIDE_GAMUT
);
let
promise
=
windowClass
.
setColorSpace
(
window
.
ColorSpace
.
WIDE_GAMUT
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting window colorspace.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting window colorspace.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2542,12 +2540,12 @@ setBackgroundColor(color: string, callback: AsyncCallback<void>): void
...
@@ -2542,12 +2540,12 @@ setBackgroundColor(color: string, callback: AsyncCallback<void>): void
```
js
```
js
let
color
=
'
#00ff33
'
;
let
color
=
'
#00ff33
'
;
windowClass
.
setBackgroundColor
(
color
,
(
err
,
data
)
=>
{
windowClass
.
setBackgroundColor
(
color
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the background color.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the background color.
'
);
});
});
```
```
...
@@ -2576,8 +2574,8 @@ setBackgroundColor(color: string): Promise<void>
...
@@ -2576,8 +2574,8 @@ setBackgroundColor(color: string): Promise<void>
```
js
```
js
let
color
=
'
#00ff33
'
;
let
color
=
'
#00ff33
'
;
let
promise
=
windowClass
.
setBackgroundColor
(
color
);
let
promise
=
windowClass
.
setBackgroundColor
(
color
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the background color.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the background color.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2625,12 +2623,12 @@ setBrightness(brightness: number, callback: AsyncCallback<void>): void
...
@@ -2625,12 +2623,12 @@ setBrightness(brightness: number, callback: AsyncCallback<void>): void
```
js
```
js
let
brightness
=
1
;
let
brightness
=
1
;
windowClass
.
setBrightness
(
brightness
,
(
err
,
data
)
=>
{
windowClass
.
setBrightness
(
brightness
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the brightness.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the brightness.
'
);
});
});
```
```
...
@@ -2659,8 +2657,8 @@ setBrightness(brightness: number): Promise<void>
...
@@ -2659,8 +2657,8 @@ setBrightness(brightness: number): Promise<void>
```
js
```
js
let
brightness
=
1
;
let
brightness
=
1
;
let
promise
=
windowClass
.
setBrightness
(
brightness
);
let
promise
=
windowClass
.
setBrightness
(
brightness
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the brightness.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the brightness.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2688,12 +2686,12 @@ setDimBehind(dimBehindValue: number, callback: AsyncCallback<void>): void
...
@@ -2688,12 +2686,12 @@ setDimBehind(dimBehindValue: number, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
js
windowClass
.
setDimBehind
(
0.5
,
(
err
,
data
)
=>
{
windowClass
.
setDimBehind
(
0.5
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the dimness. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the dimness. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the dimness.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the dimness.
'
);
});
});
```
```
...
@@ -2725,8 +2723,8 @@ setDimBehind(dimBehindValue: number): Promise<void>
...
@@ -2725,8 +2723,8 @@ setDimBehind(dimBehindValue: number): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
setDimBehind
(
0.5
);
let
promise
=
windowClass
.
setDimBehind
(
0.5
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the dimness.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the dimness.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the dimness. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the dimness. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2751,12 +2749,12 @@ setFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void
...
@@ -2751,12 +2749,12 @@ setFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void
```
js
```
js
let
isFocusable
=
true
;
let
isFocusable
=
true
;
windowClass
.
setFocusable
(
isFocusable
,
(
err
,
data
)
=>
{
windowClass
.
setFocusable
(
isFocusable
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window to be focusable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to be focusable.
'
);
});
});
```
```
...
@@ -2785,8 +2783,8 @@ setFocusable(isFocusable: boolean): Promise<void>
...
@@ -2785,8 +2783,8 @@ setFocusable(isFocusable: boolean): Promise<void>
```
js
```
js
let
isFocusable
=
true
;
let
isFocusable
=
true
;
let
promise
=
windowClass
.
setFocusable
(
isFocusable
);
let
promise
=
windowClass
.
setFocusable
(
isFocusable
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window to be focusable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to be focusable.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2811,12 +2809,12 @@ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): v
...
@@ -2811,12 +2809,12 @@ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): v
```
js
```
js
let
isKeepScreenOn
=
true
;
let
isKeepScreenOn
=
true
;
windowClass
.
setKeepScreenOn
(
isKeepScreenOn
,
(
err
,
data
)
=>
{
windowClass
.
setKeepScreenOn
(
isKeepScreenOn
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the screen to be always on. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the screen to be always on. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the screen to be always on.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the screen to be always on.
'
);
});
});
```
```
...
@@ -2874,12 +2872,12 @@ setOutsideTouchable(touchable: boolean, callback: AsyncCallback<void>): vo
...
@@ -2874,12 +2872,12 @@ setOutsideTouchable(touchable: boolean, callback: AsyncCallback<void>): vo
**示例:**
**示例:**
```
js
```
js
windowClass
.
setOutsideTouchable
(
true
,
(
err
,
data
)
=>
{
windowClass
.
setOutsideTouchable
(
true
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the area to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the area to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the area to be touchable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the area to be touchable.
'
);
})
})
```
```
...
@@ -2911,8 +2909,8 @@ setOutsideTouchable(touchable: boolean): Promise<void>
...
@@ -2911,8 +2909,8 @@ setOutsideTouchable(touchable: boolean): Promise<void>
```
js
```
js
let
promise
=
windowClass
.
setOutsideTouchable
(
true
);
let
promise
=
windowClass
.
setOutsideTouchable
(
true
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the area to be touchable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the area to be touchable.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the area to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the area to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -2937,12 +2935,12 @@ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): voi
...
@@ -2937,12 +2935,12 @@ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): voi
```
js
```
js
let
isPrivacyMode
=
true
;
let
isPrivacyMode
=
true
;
windowClass
.
setPrivacyMode
(
isPrivacyMode
,
(
err
,
data
)
=>
{
windowClass
.
setPrivacyMode
(
isPrivacyMode
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window to privacy mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to privacy mode.
'
);
});
});
```
```
...
@@ -2972,8 +2970,8 @@ setPrivacyMode(isPrivacyMode: boolean): Promise<void>
...
@@ -2972,8 +2970,8 @@ setPrivacyMode(isPrivacyMode: boolean): Promise<void>
```
js
```
js
let
isPrivacyMode
=
true
;
let
isPrivacyMode
=
true
;
let
promise
=
windowClass
.
setPrivacyMode
(
isPrivacyMode
);
let
promise
=
windowClass
.
setPrivacyMode
(
isPrivacyMode
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window to privacy mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to privacy mode.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -3017,12 +3015,12 @@ setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void
...
@@ -3017,12 +3015,12 @@ setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void
```
js
```
js
let
isTouchable
=
true
;
let
isTouchable
=
true
;
windowClass
.
setTouchable
(
isTouchable
,
(
err
,
data
)
=>
{
windowClass
.
setTouchable
(
isTouchable
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window to be touchable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to be touchable.
'
);
});
});
```
```
...
@@ -3052,8 +3050,8 @@ setTouchable(isTouchable: boolean): Promise<void>
...
@@ -3052,8 +3050,8 @@ setTouchable(isTouchable: boolean): Promise<void>
```
js
```
js
let
isTouchable
=
true
;
let
isTouchable
=
true
;
let
promise
=
windowClass
.
setTouchable
(
isTouchable
);
let
promise
=
windowClass
.
setTouchable
(
isTouchable
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window to be touchable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to be touchable.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -3080,12 +3078,12 @@ setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback<void&g
...
@@ -3080,12 +3078,12 @@ setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback<void&g
```
js
```
js
let
isForbidSplitMove
=
true
;
let
isForbidSplitMove
=
true
;
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
,
(
err
,
data
)
=>
{
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in forbidding window moving in split screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in forbidding window moving in split screen mode.
'
);
});
});
```
```
...
@@ -3117,8 +3115,8 @@ setForbidSplitMove(isForbidSplitMove: boolean): Promise<void>
...
@@ -3117,8 +3115,8 @@ setForbidSplitMove(isForbidSplitMove: boolean): Promise<void>
```
js
```
js
let
isForbidSplitMove
=
true
;
let
isForbidSplitMove
=
true
;
let
promise
=
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
);
let
promise
=
windowClass
.
setForbidSplitMove
(
isForbidSplitMove
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in forbidding window moving in split screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in forbidding window moving in split screen mode.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
});
});
...
@@ -3713,12 +3711,12 @@ class myAbility extends Ability {
...
@@ -3713,12 +3711,12 @@ class myAbility extends Ability {
this
.
storage
=
new
LocalStorage
();
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
,(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
}
}
}
}
...
@@ -3757,11 +3755,9 @@ class myAbility extends Ability {
...
@@ -3757,11 +3755,9 @@ class myAbility extends Ability {
this
.
storage
=
new
LocalStorage
();
this
.
storage
=
new
LocalStorage
();
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
this
.
storage
.
setOrCreate
(
'
storageSimpleProp
'
,
121
);
console
.
log
(
'
onWindowStageCreate
'
);
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
((
data
)
=>
{
promise
.
then
(()
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in loading the content.
'
);
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
...
@@ -3793,12 +3789,12 @@ import Ability from '@ohos.application.Ability';
...
@@ -3793,12 +3789,12 @@ import Ability from '@ohos.application.Ability';
class
myAbility
extends
Ability
{
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
console
.
log
(
'
onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/page2
'
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
'
pages/page2
'
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
}
}
}
}
...
...
zh-cn/application-dev/windowmanager/application-window-fa.md
浏览文件 @
3eca0ebd
...
@@ -91,20 +91,20 @@
...
@@ -91,20 +91,20 @@
```
js
```
js
// 移动子窗口位置。
// 移动子窗口位置。
windowClass
.
moveTo
(
300
,
300
,
(
err
,
data
)
=>
{
windowClass
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
});
});
// 改变子窗口大小。
// 改变子窗口大小。
windowClass
.
resetSize
(
500
,
1000
,
(
err
,
data
)
=>
{
windowClass
.
resetSize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
});
});
```
```
...
@@ -114,19 +114,19 @@
...
@@ -114,19 +114,19 @@
```
js
```
js
// 为子窗口加载对应的目标页面。
// 为子窗口加载对应的目标页面。
windowClass
.
loadContent
(
"
pages/page2
"
,
(
err
,
data
)
=>
{
windowClass
.
loadContent
(
"
pages/page2
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
// 显示子窗口。
// 显示子窗口。
windowClass
.
show
((
err
,
data
)
=>
{
windowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
});
});
});
});
```
```
...
@@ -137,12 +137,12 @@
...
@@ -137,12 +137,12 @@
```
js
```
js
// 销毁子窗口。当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用destroy接口销毁子窗口。
// 销毁子窗口。当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用destroy接口销毁子窗口。
windowClass
.
destroy
((
err
,
data
)
=>
{
windowClass
.
destroy
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to destroy the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to destroy the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in destroying the subwindow.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in destroying the subwindow.
'
);
});
});
```
```
...
@@ -186,31 +186,31 @@
...
@@ -186,31 +186,31 @@
```
js
```
js
// 实现沉浸式效果。方式一:设置窗口全屏显示。
// 实现沉浸式效果。方式一:设置窗口全屏显示。
let
isFullScreen
=
true
;
let
isFullScreen
=
true
;
mainWindowClass
.
setFullScreen
(
isFullScreen
,
(
err
,
data
)
=>
{
mainWindowClass
.
setFullScreen
(
isFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in enabling the full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in enabling the full-screen mode.
'
);
});
});
// 实现沉浸式效果。方式二:设置导航栏、状态栏不显示。
// 实现沉浸式效果。方式二:设置导航栏、状态栏不显示。
let
names
=
[];
let
names
=
[];
mainWindowClass
.
setSystemBarEnable
(
names
,
(
err
,
data
)
=>
{
mainWindowClass
.
setSystemBarEnable
(
names
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar to be visible. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar to be visible. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar to be visible.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar to be visible.
'
);
});
});
// 实现沉浸式效果。
// 实现沉浸式效果。
// 方式三:设置窗口为全屏布局,配合设置状态栏、导航栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。
// 方式三:设置窗口为全屏布局,配合设置状态栏、导航栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。
let
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
mainWindowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
,
data
)
=>
{
mainWindowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
'
);
});
});
let
sysBarProps
=
{
let
sysBarProps
=
{
statusBarColor
:
'
#ff00ff
'
,
statusBarColor
:
'
#ff00ff
'
,
...
@@ -219,12 +219,12 @@
...
@@ -219,12 +219,12 @@
statusBarContentColor
:
'
#ffffff
'
,
statusBarContentColor
:
'
#ffffff
'
,
navigationBarContentColor
:
'
#ffffff
'
navigationBarContentColor
:
'
#ffffff
'
};
};
mainWindowClass
.
setSystemBarProperties
(
sysBarProps
,
(
err
,
data
)
=>
{
mainWindowClass
.
setSystemBarProperties
(
sysBarProps
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar properties.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar properties.
'
);
});
});
```
```
...
@@ -234,19 +234,19 @@
...
@@ -234,19 +234,19 @@
```
js
```
js
// 为沉浸式窗口加载对应的目标页面。
// 为沉浸式窗口加载对应的目标页面。
mainWindowClass
.
loadContent
(
"
pages/page3
"
,
(
err
,
data
)
=>
{
mainWindowClass
.
loadContent
(
"
pages/page3
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
// 显示沉浸式窗口。
// 显示沉浸式窗口。
mainWindowClass
.
show
((
err
,
data
)
=>
{
mainWindowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
});
});
});
});
```
```
\ No newline at end of file
zh-cn/application-dev/windowmanager/application-window-stage.md
浏览文件 @
3eca0ebd
...
@@ -82,21 +82,21 @@ class MainAbility extends Ability {
...
@@ -82,21 +82,21 @@ class MainAbility extends Ability {
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
// 2.设置主窗口属性。以设置"是否可触"属性为例。
// 2.设置主窗口属性。以设置"是否可触"属性为例。
let
isTouchable
=
true
;
let
isTouchable
=
true
;
windowClass
.
setTouchable
(
isTouchable
,
(
err
,
data
)
=>
{
windowClass
.
setTouchable
(
isTouchable
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window to be touchable.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window to be touchable.
'
);
})
})
})
})
// 3.为主窗口加载对应的目标页面。
// 3.为主窗口加载对应的目标页面。
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
}
}
};
};
...
@@ -149,34 +149,34 @@ class MainAbility extends Ability {
...
@@ -149,34 +149,34 @@ class MainAbility extends Ability {
sub_windowClass
=
data
;
sub_windowClass
=
data
;
});
});
// 2.子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
// 2.子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
sub_windowClass
.
moveTo
(
300
,
300
,
(
err
,
data
)
=>
{
sub_windowClass
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
});
});
sub_windowClass
.
resetSize
(
500
,
1000
,
(
err
,
data
)
=>
{
sub_windowClass
.
resetSize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
});
});
// 3.为子窗口加载对应的目标页面。
// 3.为子窗口加载对应的目标页面。
sub_windowClass
.
loadContent
(
"
pages/page3
"
,
(
err
,
data
)
=>
{
sub_windowClass
.
loadContent
(
"
pages/page3
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
// 3.显示子窗口。
// 3.显示子窗口。
sub_windowClass
.
show
((
err
,
data
)
=>
{
sub_windowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
});
});
});
});
})
})
...
@@ -184,12 +184,12 @@ class MainAbility extends Ability {
...
@@ -184,12 +184,12 @@ class MainAbility extends Ability {
destroySubWindow
()
{
destroySubWindow
()
{
// 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。
// 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁。
sub_windowClass
.
destroy
((
err
,
data
)
=>
{
sub_windowClass
.
destroy
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in destroying the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in destroying the window.
'
);
});
});
}
}
...
@@ -242,30 +242,30 @@ class MainAbility extends Ability {
...
@@ -242,30 +242,30 @@ class MainAbility extends Ability {
// 2.实现沉浸式效果。方式一:设置应用主窗口为全屏显示。
// 2.实现沉浸式效果。方式一:设置应用主窗口为全屏显示。
let
isFullScreen
=
true
;
let
isFullScreen
=
true
;
windowClass
.
setFullScreen
(
isFullScreen
,
(
err
,
data
)
=>
{
windowClass
.
setFullScreen
(
isFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to enable the full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in enabling the full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in enabling the full-screen mode.
'
);
});
});
// 2.实现沉浸式效果。方式二:设置导航栏、状态栏不显示。
// 2.实现沉浸式效果。方式二:设置导航栏、状态栏不显示。
let
names
=
[];
let
names
=
[];
windowClass
.
setSystemBarEnable
(
names
,
(
err
,
data
)
=>
{
windowClass
.
setSystemBarEnable
(
names
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar to be visible. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar to be visible. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar to be visible.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar to be visible.
'
);
});
});
// 2.实现沉浸式效果。方式三:设置窗口为全屏布局,配合设置导航栏、状态栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。
// 2.实现沉浸式效果。方式三:设置窗口为全屏布局,配合设置导航栏、状态栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。
let
isLayoutFullScreen
=
true
;
let
isLayoutFullScreen
=
true
;
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
,
data
)
=>
{
windowClass
.
setLayoutFullScreen
(
isLayoutFullScreen
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the window layout to full-screen mode.
'
);
});
});
let
sysBarProps
=
{
let
sysBarProps
=
{
statusBarColor
:
'
#ff00ff
'
,
statusBarColor
:
'
#ff00ff
'
,
...
@@ -274,21 +274,21 @@ class MainAbility extends Ability {
...
@@ -274,21 +274,21 @@ class MainAbility extends Ability {
statusBarContentColor
:
'
#ffffff
'
,
statusBarContentColor
:
'
#ffffff
'
,
navigationBarContentColor
:
'
#ffffff
'
navigationBarContentColor
:
'
#ffffff
'
};
};
windowClass
.
setSystemBarProperties
(
sysBarProps
,
(
err
,
data
)
=>
{
windowClass
.
setSystemBarProperties
(
sysBarProps
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in setting the system bar properties.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in setting the system bar properties.
'
);
});
});
})
})
// 3.为沉浸式窗口加载对应的目标页面。
// 3.为沉浸式窗口加载对应的目标页面。
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
"
pages/page2
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
});
});
}
}
};
};
...
@@ -356,43 +356,43 @@ class MainAbility extends Ability {
...
@@ -356,43 +356,43 @@ class MainAbility extends Ability {
console
.
info
(
'
Succeeded in creating the floatWindow. Data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
Succeeded in creating the floatWindow. Data:
'
+
JSON
.
stringify
(
data
));
windowClass
=
data
;
windowClass
=
data
;
// 3.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
// 3.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
windowClass
.
moveTo
(
300
,
300
,
(
err
,
data
)
=>
{
windowClass
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
});
});
windowClass
.
resetSize
(
500
,
1000
,
(
err
,
data
)
=>
{
windowClass
.
resetSize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
});
});
// 4.为悬浮窗加载对应的目标页面。
// 4.为悬浮窗加载对应的目标页面。
windowClass
.
loadContent
(
"
pages/page4
"
,
(
err
,
data
)
=>
{
windowClass
.
loadContent
(
"
pages/page4
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
// 4.显示悬浮窗。
// 4.显示悬浮窗。
windowClass
.
show
((
err
,
data
)
=>
{
windowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
});
});
});
});
//5.销毁悬浮窗。当不再需要悬浮窗时,可根据具体实现逻辑,使用destroy对其进行销毁。
//5.销毁悬浮窗。当不再需要悬浮窗时,可根据具体实现逻辑,使用destroy对其进行销毁。
windowClass
.
destroy
((
err
,
data
)
=>
{
windowClass
.
destroy
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in destroying the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in destroying the window.
'
);
});
});
});
});
}
}
...
...
zh-cn/application-dev/windowmanager/system-window-stage.md
浏览文件 @
3eca0ebd
...
@@ -65,46 +65,46 @@ export default class ServiceExtensionAbility1 extends ExtensionContext {
...
@@ -65,46 +65,46 @@ export default class ServiceExtensionAbility1 extends ExtensionContext {
console
.
info
(
'
Succeeded in creating the volume window.
'
)
console
.
info
(
'
Succeeded in creating the volume window.
'
)
windowClass
=
data
;
windowClass
=
data
;
// 2.创建音量条窗口成功之后,可以改变其大小、位置或设置背景色、亮度等属性。
// 2.创建音量条窗口成功之后,可以改变其大小、位置或设置背景色、亮度等属性。
windowClass
.
moveTo
(
300
,
300
,
(
err
,
data
)
=>
{
windowClass
.
moveTo
(
300
,
300
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in moving the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in moving the window.
'
);
});
});
windowClass
.
resetSize
(
500
,
1000
,
(
err
,
data
)
=>
{
windowClass
.
resetSize
(
500
,
1000
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in changing the window size.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in changing the window size.
'
);
});
});
// 3.为音量条窗口加载对应的目标页面。
// 3.为音量条窗口加载对应的目标页面。
windowClass
.
loadContent
(
"
pages/page_volume
"
,
(
err
,
data
)
=>
{
windowClass
.
loadContent
(
"
pages/page_volume
"
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in loading the content.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in loading the content.
'
);
// 3.显示音量条窗口。
// 3.显示音量条窗口。
windowClass
.
show
((
err
,
data
)
=>
{
windowClass
.
show
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in showing the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in showing the window.
'
);
});
});
});
});
// 4.隐藏/销毁音量条窗口。当不再需要音量条时,可根据具体实现逻辑,对其进行隐藏或销毁。
// 4.隐藏/销毁音量条窗口。当不再需要音量条时,可根据具体实现逻辑,对其进行隐藏或销毁。
// 此处以监听音量条区域外的点击事件为例实现音量条窗口的隐藏。
// 此处以监听音量条区域外的点击事件为例实现音量条窗口的隐藏。
windowClass
.
on
(
'
touchOutside
'
,
()
=>
{
windowClass
.
on
(
'
touchOutside
'
,
()
=>
{
console
.
info
(
'
touch outside
'
);
console
.
info
(
'
touch outside
'
);
windowClass
.
hide
((
err
,
data
)
=>
{
windowClass
.
hide
((
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
return
;
}
}
console
.
info
(
'
Succeeded in hidinging the window.
Data:
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
Succeeded in hidinging the window.
'
);
});
});
});
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录