Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
6b332360
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看板
未验证
提交
6b332360
编写于
11月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11555 doc文档示例代码整改
Merge pull request !11555 from ZhengJiangliang/master
上级
a8263f37
cb4606f0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
209 addition
and
193 deletion
+209
-193
zh-cn/application-dev/reference/apis/js-apis-display.md
zh-cn/application-dev/reference/apis/js-apis-display.md
+35
-34
zh-cn/application-dev/reference/apis/js-apis-window.md
zh-cn/application-dev/reference/apis/js-apis-window.md
+174
-159
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-display.md
浏览文件 @
6b332360
...
...
@@ -94,7 +94,7 @@ try {
displayClass
=
display
.
getDefaultDisplaySync
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## display.getAllDisplays<sup>9+</sup>
...
...
@@ -204,25 +204,24 @@ hasPrivateWindow(displayId: number): boolean
let
displayClass
=
null
;
try
{
displayClass
=
display
.
getDefaultDisplaySync
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
return
;
};
let
ret
=
undefined
;
try
{
ret
=
display
.
hasPrivateWindow
(
displayClass
.
id
);
let
ret
=
undefined
;
try
{
ret
=
display
.
hasPrivateWindow
(
displayClass
.
id
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to check has privateWindow or not. Code:
'
+
JSON
.
stringify
(
exception
));
}
if
(
ret
==
undefined
)
{
console
.
log
(
"
Failed to check has privateWindow or not.
"
);
}
if
(
ret
)
{
console
.
log
(
"
There has privateWindow.
"
);
}
else
if
(
!
ret
)
{
console
.
log
(
"
There has no privateWindow.
"
);
}
}
catch
(
exception
)
{
console
.
error
(
'
Failed to check has privateWindow or not. Code:
'
+
JSON
.
stringify
(
exception
));
};
if
(
ret
==
undefined
)
{
console
.
log
(
"
Failed to check has privateWindow or not.
"
);
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
}
if
(
ret
)
{
console
.
log
(
"
There has privateWindow.
"
);
}
else
if
(
!
ret
)
{
console
.
log
(
"
There has no privateWindow.
"
);
};
```
## display.on('add'|'remove'|'change')
...
...
@@ -250,7 +249,7 @@ try {
display
.
on
(
"
add
"
,
callback
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to register callback. Code:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## display.off('add'|'remove'|'change')
...
...
@@ -275,7 +274,7 @@ try {
display
.
off
(
"
remove
"
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to unregister callback. Code:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## display.getDefaultDisplay<sup>(deprecated)</sup>
...
...
@@ -450,17 +449,17 @@ getCutoutInfo(callback: AsyncCallback<CutoutInfo>): void
let
displayClass
=
null
;
try
{
displayClass
=
display
.
getDefaultDisplaySync
();
displayClass
.
getCutoutInfo
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to get cutoutInfo. Code:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in getting cutoutInfo. data:
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
};
displayClass
.
getCutoutInfo
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to get cutoutInfo. Code:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in getting cutoutInfo. data:
'
+
JSON
.
stringify
(
data
));
});
}
```
### getCutoutInfo<sup>9+</sup>
getCutoutInfo(): Promise
<
CutoutInfo
>
...
...
@@ -489,12 +488,14 @@ getCutoutInfo(): Promise<CutoutInfo>
let
displayClass
=
null
;
try
{
displayClass
=
display
.
getDefaultDisplaySync
();
let
promise
=
displayClass
.
getCutoutInfo
();
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in getting cutoutInfo. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to obtain all the display objects. Code:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
};
let
promise
=
displayClass
.
getCutoutInfo
();
promise
.
then
((
data
)
=>
{
console
.
info
(
'
Succeeded in getting cutoutInfo. Data:
'
+
JSON
.
stringify
(
data
));
});
}
```
zh-cn/application-dev/reference/apis/js-apis-window.md
浏览文件 @
6b332360
...
...
@@ -339,7 +339,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to create the window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.createWindow<sup>9+</sup>
...
...
@@ -386,7 +386,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to create the window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.findWindow<sup>9+</sup>
...
...
@@ -412,11 +412,12 @@ findWindow(name: string): Window
**示例:**
```
js
let
windowClass
=
null
;
try
{
let
windowClass
=
window
.
findWindow
(
'
alertWindow
'
);
windowClass
=
window
.
findWindow
(
'
alertWindow
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to find the Window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.getLastWindow<sup>9+</sup>
...
...
@@ -458,7 +459,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.getLastWindow<sup>9+</sup>
...
...
@@ -504,7 +505,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.minimizeAll<sup>9+</sup>
...
...
@@ -535,26 +536,25 @@ minimizeAll(id: number, callback: AsyncCallback<void>): void
```
js
import
display
from
'
@ohos.display
'
import
window
from
'
@ohos.window
'
let
displayClass
=
null
;
try
{
displayClass
=
display
.
getDefaultDisplaySync
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
return
;
};
try
{
window
.
minimizeAll
(
displayClass
.
id
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
});
try
{
window
.
minimizeAll
(
displayClass
.
id
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
exception
));
}
}
catch
(
exception
)
{
console
.
error
(
'
Failed to
minimize all windows. Caus
e:
'
+
JSON
.
stringify
(
exception
));
}
;
console
.
error
(
'
Failed to
obtain the default display object. Cod
e:
'
+
JSON
.
stringify
(
exception
));
}
```
## window.minimizeAll<sup>9+</sup>
...
...
@@ -590,26 +590,24 @@ minimizeAll(id: number): Promise<void>
```
js
import
display
from
'
@ohos.display
'
import
window
from
'
@ohos.window
'
let
displayClass
=
null
;
try
{
displayClass
=
display
.
getDefaultDisplaySync
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the default display object. Code:
'
+
JSON
.
stringify
(
exception
));
return
;
};
try
{
let
promise
=
window
.
minimizeAll
(
displayClass
.
id
);
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
});
try
{
let
promise
=
window
.
minimizeAll
(
displayClass
.
id
);
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in minimizing all windows.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to minimize all windows. Cause:
'
+
JSON
.
stringify
(
exception
));
}
}
catch
(
exception
)
{
console
.
error
(
'
Failed to
minimize all windows. Caus
e:
'
+
JSON
.
stringify
(
exception
));
}
;
console
.
error
(
'
Failed to
obtain the default display object. Cod
e:
'
+
JSON
.
stringify
(
exception
));
}
```
## window.toggleShownStateForAllAppWindows<sup>9+</sup>
...
...
@@ -644,7 +642,7 @@ window.toggleShownStateForAllAppWindows((err) => {
return
;
}
console
.
info
(
'
Succeeded in toggling shown state for all app windows.
'
);
})
})
;
```
## window.toggleShownStateForAllAppWindows<sup>9+</sup>
...
...
@@ -678,7 +676,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in toggling shown state for all app windows.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to toggle shown state for all app windows. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
## window.setWindowLayoutMode<sup>9+</sup>
...
...
@@ -718,7 +716,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window layout mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.setWindowLayoutMode<sup>9+</sup>
...
...
@@ -762,7 +760,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window layout mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.on('systemBarTintChange')<sup>8+</sup>
...
...
@@ -791,7 +789,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for systemBarTint changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.off('systemBarTintChange')<sup>8+</sup>
...
...
@@ -818,7 +816,7 @@ try {
window
.
off
(
'
systemBarTintChange
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to disable the listener for systemBarTint changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
## window.create<sup>(deprecated)</sup>
...
...
@@ -1110,7 +1108,7 @@ promise.then((data)=> {
console
.
info
(
'
Succeeded in obtaining the top window. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
## window.getTopWindow<sup>(deprecated)</sup>
...
...
@@ -1180,7 +1178,7 @@ promise.then((data)=> {
console
.
info
(
'
Succeeded in obtaining the top window. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
## Window
...
...
@@ -1222,7 +1220,7 @@ windowClass.hide((err) => {
return
;
}
console
.
info
(
'
Succeeded in hiding the window.
'
);
})
})
;
```
### hide<sup>7+</sup>
...
...
@@ -1257,7 +1255,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in hiding the window.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### hideWithAnimation<sup>9+</sup>
...
...
@@ -1295,7 +1293,7 @@ windowClass.hideWithAnimation((err) => {
return
;
}
console
.
info
(
'
Succeeded in hiding the window with animation.
'
);
})
})
;
```
### hideWithAnimation<sup>9+</sup>
...
...
@@ -1332,7 +1330,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in hiding the window with animation.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to hide the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### showWindow<sup>9+</sup>
...
...
@@ -1437,7 +1435,7 @@ windowClass.showWithAnimation((err) => {
return
;
}
console
.
info
(
'
Succeeded in showing the window with animation.
'
);
})
})
;
```
### showWithAnimation<sup>9+</sup>
...
...
@@ -1474,7 +1472,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in showing the window with animation.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### destroyWindow<sup>9+</sup>
...
...
@@ -1509,7 +1507,7 @@ windowClass.destroyWindow((err) => {
return
;
}
console
.
info
(
'
Succeeded in destroying the window.
'
);
})
})
;
```
### destroyWindow<sup>9+</sup>
...
...
@@ -1543,7 +1541,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in destroying the window.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### moveWindowTo<sup>9+</sup>
...
...
@@ -1584,7 +1582,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### moveWindowTo<sup>9+</sup>
...
...
@@ -1629,7 +1627,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### resize<sup>9+</sup>
...
...
@@ -1676,7 +1674,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### resize<sup>9+</sup>
...
...
@@ -1727,7 +1725,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to change the window size. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowMode<sup>9+</sup>
...
...
@@ -1770,7 +1768,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowMode<sup>9+</sup>
...
...
@@ -1809,7 +1807,7 @@ setWindowMode(mode: WindowMode): Promise<void>
```
js
let
mode
=
window
.
WindowMode
.
FULLSCREEN
;
try
{
let
promise
=
windowClass
.
setWindowMode
(
typ
e
);
let
promise
=
windowClass
.
setWindowMode
(
mod
e
);
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in setting the window mode.
'
);
}).
catch
((
err
)
=>
{
...
...
@@ -1817,7 +1815,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### getWindowProperties<sup>9+</sup>
...
...
@@ -1849,7 +1847,7 @@ try {
let
properties
=
windowClass
.
getWindowProperties
();
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the window properties. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### getWindowAvoidArea<sup>9+</sup>
...
...
@@ -1888,7 +1886,7 @@ try {
let
avoidArea
=
windowClass
.
getWindowAvoidArea
(
type
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to obtain the area. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowLayoutFullScreen<sup>9+</sup>
...
...
@@ -1929,7 +1927,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowLayoutFullScreen<sup>9+</sup>
...
...
@@ -1974,7 +1972,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window layout to full-screen mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowSystemBarEnable<sup>9+</sup>
...
...
@@ -2016,7 +2014,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowSystemBarEnable<sup>9+</sup>
...
...
@@ -2062,7 +2060,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the system bar to be invisible. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowSystemBarProperties<sup>9+</sup>
...
...
@@ -2092,7 +2090,7 @@ setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback:
**示例:**
```
js
let
SystemBarProperties
=
{
let
SystemBarProperties
=
{
statusBarColor
:
'
#ff00ff
'
,
navigationBarColor
:
'
#00ff00
'
,
//以下两个属性从API Version8开始支持
...
...
@@ -2109,7 +2107,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowSystemBarProperties<sup>9+</sup>
...
...
@@ -2144,7 +2142,7 @@ setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise&
**示例:**
```
js
let
SystemBarProperties
=
{
let
SystemBarProperties
=
{
statusBarColor
:
'
#ff00ff
'
,
navigationBarColor
:
'
#00ff00
'
,
//以下两个属性从API Version8开始支持
...
...
@@ -2160,7 +2158,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the system bar properties. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setPreferredOrientation<sup>9+</sup>
...
...
@@ -2200,7 +2198,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window orientation. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setPreferredOrientation<sup>9+</sup>
...
...
@@ -2244,7 +2242,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window orientation. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setUIContent<sup>9+</sup>
...
...
@@ -2284,7 +2282,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setUIContent<sup>9+</sup>
...
...
@@ -2328,7 +2326,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### loadContent<sup>9+</sup>
...
...
@@ -2374,7 +2372,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### loadContent<sup>9+</sup>
...
...
@@ -2424,7 +2422,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### isWindowShowing<sup>9+</sup>
...
...
@@ -2457,7 +2455,7 @@ try {
console
.
info
(
'
Succeeded in checking whether the window is showing. Data:
'
+
JSON
.
stringify
(
data
));
}
catch
(
exception
)
{
console
.
error
(
'
Failed to check whether the window is showing. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('windowSizeChange')<sup>7+</sup>
...
...
@@ -2484,7 +2482,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for window size changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('windowSizeChange')<sup>7+</sup>
...
...
@@ -2509,7 +2507,7 @@ try {
windowClass
.
off
(
'
windowSizeChange
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to disable the listener for window size changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('avoidAreaChange')<sup>9+</sup>
...
...
@@ -2537,7 +2535,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for system avoid area changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('avoidAreaChange')<sup>9+</sup>
...
...
@@ -2562,7 +2560,7 @@ try {
windowClass
.
off
(
'
avoidAreaChange
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to disable the listener for system avoid area changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('keyboardHeightChange')<sup>7+</sup>
...
...
@@ -2589,7 +2587,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for keyboard height changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('keyboardHeightChange')<sup>7+</sup>
...
...
@@ -2614,7 +2612,7 @@ try {
windowClass
.
off
(
'
keyboardHeightChange
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to disable the listener for keyboard height changes. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('touchOutside')<sup>9+</sup>
...
...
@@ -2643,7 +2641,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to register callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('touchOutside')<sup>9+</sup>
...
...
@@ -2670,7 +2668,7 @@ try {
windowClass
.
off
(
'
touchOutside
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to unregister callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('screenshot')<sup>9+</sup>
...
...
@@ -2697,7 +2695,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to register callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('screenshot')<sup>9+</sup>
...
...
@@ -2718,21 +2716,21 @@ off(type: 'screenshot', callback?: Callback<void>): void
**示例:**
```
js
let
callback
=
()
=>
{
let
callback
=
()
=>
{
console
.
info
(
'
screenshot happened
'
);
};
try
{
windowClass
.
on
(
'
screenshot
'
,
callback
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to register callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
try
{
windowClass
.
off
(
'
screenshot
'
,
callback
);
// 如果通过on开启多个callback进行监听,同时关闭所有监听:
windowClass
.
off
(
'
screenshot
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to unregister callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### on('dialogTargetTouch')<sup>9+</sup>
...
...
@@ -2759,7 +2757,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to register callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### off('dialogTargetTouch')<sup>9+</sup>
...
...
@@ -2784,7 +2782,7 @@ try {
windowClass
.
off
(
'
dialogTargetTouch
'
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to unregister callback. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### bindDialogTarget<sup>9+</sup>
...
...
@@ -2817,6 +2815,8 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>, c
**示例:**
```
js
import
rpc
from
'
@ohos.rpc
'
;
class
MyDeathRecipient
{
onRemoteDied
()
{
console
.
log
(
'
server died
'
);
...
...
@@ -2836,6 +2836,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return
false
;
}
}
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
try
{
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
...
...
@@ -2849,7 +2850,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### bindDialogTarget<sup>9+</sup>
...
...
@@ -2887,6 +2888,8 @@ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>):
**示例:**
```
js
import
rpc
from
'
@ohos.rpc
'
;
class
MyDeathRecipient
{
onRemoteDied
()
{
console
.
log
(
'
server died
'
);
...
...
@@ -2906,6 +2909,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return
false
;
}
}
let
token
=
new
TestRemoteObject
(
'
testObject
'
);
try
{
let
promise
=
windowClass
.
bindDialogTarget
(
token
,
()
=>
{
...
...
@@ -2918,7 +2922,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to bind dialog target. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### isWindowSupportWideGamut<sup>9+</sup>
...
...
@@ -3024,7 +3028,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowColorSpace<sup>9+</sup>
...
...
@@ -3067,7 +3071,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set window colorspace. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### getWindowColorSpace<sup>9+</sup>
...
...
@@ -3128,7 +3132,7 @@ try {
windowClass
.
setWindowBackgroundColor
(
color
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the background color. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowBrightness<sup>9+</sup>
...
...
@@ -3169,7 +3173,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowBrightness<sup>9+</sup>
...
...
@@ -3214,7 +3218,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the brightness. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowFocusable<sup>9+</sup>
...
...
@@ -3244,7 +3248,7 @@ setWindowFocusable(isFocusable: boolean, callback: AsyncCallback<void>): v
**示例:**
```
js
let
isFocusable
=
true
;
let
isFocusable
=
true
;
try
{
windowClass
.
setWindowFocusable
(
isFocusable
,
(
err
)
=>
{
if
(
err
.
code
)
{
...
...
@@ -3255,7 +3259,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowFocusable<sup>9+</sup>
...
...
@@ -3290,7 +3294,7 @@ setWindowFocusable(isFocusable: boolean): Promise<void>
**示例:**
```
js
let
isFocusable
=
true
;
let
isFocusable
=
true
;
try
{
let
promise
=
windowClass
.
setWindowFocusable
(
isFocusable
);
promise
.
then
(()
=>
{
...
...
@@ -3300,7 +3304,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to be focusable. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowKeepScreenOn<sup>9+</sup>
...
...
@@ -3341,7 +3345,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the screen to be always on. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowKeepScreenOn<sup>9+</sup>
...
...
@@ -3386,7 +3390,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the screen to be always on. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWakeUpScreen()<sup>9+</sup>
...
...
@@ -3422,7 +3426,7 @@ try {
windowClass
.
setWakeUpScreen
(
wakeUp
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to wake up the screen. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowPrivacyMode<sup>9+</sup>
...
...
@@ -3464,7 +3468,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowPrivacyMode<sup>9+</sup>
...
...
@@ -3510,7 +3514,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to privacy mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setSnapshotSkip<sup>9+</sup>
...
...
@@ -3583,7 +3587,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setWindowTouchable<sup>9+</sup>
...
...
@@ -3628,7 +3632,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set the window to be touchable. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setForbidSplitMove<sup>9+</sup>
...
...
@@ -3671,7 +3675,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setForbidSplitMove<sup>9+</sup>
...
...
@@ -3718,7 +3722,7 @@ try {
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to forbid window moving in split screen mode. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### snapshot<sup>9+</sup>
...
...
@@ -3822,7 +3826,7 @@ try {
windowClass
.
opacity
(
0.5
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to opacity. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### scale<sup>9+</sup>
...
...
@@ -3863,7 +3867,7 @@ try {
windowClass
.
scale
(
obj
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to scale. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### rotate<sup>9+</sup>
...
...
@@ -3905,7 +3909,7 @@ try {
windowClass
.
rotate
(
obj
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to rotate. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### translate<sup>9+</sup>
...
...
@@ -3945,7 +3949,7 @@ try {
windowClass
.
translate
(
obj
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to translate. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### getTransitionController<sup>9+</sup>
...
...
@@ -3998,16 +4002,16 @@ controller.animationForHidden = (context : window.TransitionContext) => {
toWindow
.
translate
(
obj
);
// 设置动画过程中的属性转换
console
.
info
(
'
toWindow translate end
'
);
}
)
)
;
console
.
info
(
'
complete transition end
'
);
}
}
;
windowClass
.
hideWithAnimation
((
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to show the window with animation. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in showing the window with animation. Data:
'
+
JSON
.
stringify
(
data
));
})
})
;
```
### setBlur<sup>9+</sup>
...
...
@@ -4042,7 +4046,7 @@ try {
windowClass
.
setBlur
(
4.0
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set blur. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setBackdropBlur<sup>9+</sup>
...
...
@@ -4077,7 +4081,7 @@ try {
windowClass
.
setBackdropBlur
(
4.0
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set backdrop blur. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setBackdropBlurStyle<sup>9+</sup>
...
...
@@ -4112,7 +4116,7 @@ try {
windowClass
.
setBackdropBlurStyle
(
window
.
BlurStyle
.
THIN
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set backdrop blur style. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setShadow<sup>9+</sup>
...
...
@@ -4150,7 +4154,7 @@ try {
windowClass
.
setShadow
(
4.0
,
'
#FF00FF00
'
,
2
,
3
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set shadow. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### setCornerRadius<sup>9+</sup>
...
...
@@ -4185,7 +4189,7 @@ try {
windowClass
.
setCornerRadius
(
4.0
);
}
catch
(
exception
)
{
console
.
error
(
'
Failed to set corner radius. Cause:
'
+
JSON
.
stringify
(
exception
));
}
;
}
```
### show<sup>(deprecated)</sup>
...
...
@@ -4215,7 +4219,7 @@ windowClass.show((err) => {
return
;
}
console
.
info
(
'
Succeeded in showing the window.
'
);
})
})
;
```
### show<sup>(deprecated)</sup>
...
...
@@ -4244,7 +4248,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in showing the window.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to show the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### destroy<sup>(deprecated)</sup>
...
...
@@ -4274,7 +4278,7 @@ windowClass.destroy((err) => {
return
;
}
console
.
info
(
'
Succeeded in destroying the window.
'
);
})
})
;
```
### destroy<sup>(deprecated)</sup>
...
...
@@ -4303,7 +4307,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in destroying the window.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to destroy the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### moveTo<sup>(deprecated)</sup>
...
...
@@ -4335,7 +4339,6 @@ windowClass.moveTo(300, 300, (err)=>{
return
;
}
console
.
info
(
'
Succeeded in moving the window.
'
);
});
```
...
...
@@ -4372,7 +4375,7 @@ promise.then(()=> {
console
.
info
(
'
Succeeded in moving the window.
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to move the window. Cause:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
### resetSize<sup>(deprecated)</sup>
...
...
@@ -5144,7 +5147,7 @@ windowClass.isSupportWideGamut((err, data) => {
return
;
}
console
.
info
(
'
Succeeded in checking whether the window support WideGamut Data:
'
+
JSON
.
stringify
(
data
));
})
})
;
```
### isSupportWideGamut<sup>(deprecated)</sup>
...
...
@@ -5204,7 +5207,7 @@ windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
return
;
}
console
.
info
(
'
Succeeded in setting window colorspace.
'
);
})
})
;
```
### setColorSpace<sup>(deprecated)</sup>
...
...
@@ -5269,7 +5272,7 @@ windowClass.getColorSpace((err, data) => {
return
;
}
console
.
info
(
'
Succeeded in getting window colorspace. Cause:
'
+
JSON
.
stringify
(
data
));
})
})
;
```
### getColorSpace<sup>(deprecated)</sup>
...
...
@@ -5667,7 +5670,7 @@ windowClass.setOutsideTouchable(true, (err) => {
return
;
}
console
.
info
(
'
Succeeded in setting the area to be touchable.
'
);
})
})
;
```
### setOutsideTouchable<sup>(deprecated)</sup>
...
...
@@ -5734,7 +5737,6 @@ windowClass.setPrivacyMode(isPrivacyMode, (err) => {
return
;
}
console
.
info
(
'
Succeeded in setting the window to privacy mode.
'
);
});
```
...
...
@@ -5803,7 +5805,6 @@ windowClass.setTouchable(isTouchable, (err) => {
return
;
}
console
.
info
(
'
Succeeded in setting the window to be touchable.
'
);
});
```
...
...
@@ -5893,6 +5894,7 @@ getMainWindow(callback: AsyncCallback<Window>): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -5906,7 +5908,7 @@ class myAbility extends Ability {
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
});
}
}
}
;
```
### getMainWindow<sup>9+</sup>
...
...
@@ -5938,19 +5940,20 @@ getMainWindow(): Promise<Window>
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
getMainWindow
();
promise
.
then
((
data
)
=>
{
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in obtaining the main window. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
}
}
;
```
### getMainWindowSync<sup>9+</sup>
...
...
@@ -5982,6 +5985,7 @@ getMainWindowSync(): Window
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -5991,7 +5995,7 @@ class myAbility extends Ability {
console
.
error
(
'
Failed to obtain the main window. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### createSubWindow<sup>9+</sup>
...
...
@@ -6024,6 +6028,7 @@ createSubWindow(name: string, callback: AsyncCallback<Window>): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6042,7 +6047,7 @@ class myAbility extends Ability {
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### createSubWindow<sup>9+</sup>
...
...
@@ -6079,23 +6084,24 @@ createSubWindow(name: string): Promise<Window>
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
try
{
let
promise
=
windowStage
.
createSubWindow
(
'
mySubWindow
'
);
promise
.
then
((
data
)
=>
{
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in creating the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to create the subwindow. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### getSubWindow<sup>9+</sup>
...
...
@@ -6126,6 +6132,7 @@ getSubWindow(callback: AsyncCallback<Array<Window>>): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6139,7 +6146,7 @@ class myAbility extends Ability {
console
.
info
(
'
Succeeded in obtaining the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
});
}
}
}
;
```
### getSubWindow<sup>9+</sup>
...
...
@@ -6169,19 +6176,20 @@ getSubWindow(): Promise<Array<Window>>
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
let
windowClass
=
null
;
let
promise
=
windowStage
.
getSubWindow
();
promise
.
then
((
data
)
=>
{
promise
.
then
((
data
)
=>
{
windowClass
=
data
;
console
.
info
(
'
Succeeded in obtaining the subwindow. Data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to obtain the subwindow. Cause:
'
+
JSON
.
stringify
(
err
));
})
}
}
}
;
```
### loadContent<sup>9+</sup>
...
...
@@ -6214,6 +6222,7 @@ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
...
...
@@ -6232,7 +6241,7 @@ class myAbility extends Ability {
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### loadContent<sup>9+</sup>
...
...
@@ -6271,6 +6280,7 @@ loadContent(path: string, storage?: LocalStorage): Promise<void>
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
storage
:
LocalStorage
onWindowStageCreate
(
windowStage
)
{
...
...
@@ -6279,16 +6289,16 @@ class myAbility extends Ability {
console
.
log
(
'
onWindowStageCreate
'
);
try
{
let
promise
=
windowStage
.
loadContent
(
'
pages/page2
'
,
this
.
storage
);
promise
.
then
(()
=>
{
promise
.
then
(()
=>
{
console
.
info
(
'
Succeeded in loading the content.
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### loadContent<sup>9+</sup>
...
...
@@ -6321,6 +6331,7 @@ loadContent(path: string, callback: AsyncCallback<void>): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6336,7 +6347,7 @@ class myAbility extends Ability {
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### on('windowStageEvent')<sup>9+</sup>
...
...
@@ -6369,6 +6380,7 @@ on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6382,7 +6394,7 @@ class myAbility extends Ability {
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### off('windowStageEvent')<sup>9+</sup>
...
...
@@ -6415,6 +6427,7 @@ off(eventType: 'windowStageEvent', callback?: Callback<WindowStageEventType&g
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6425,7 +6438,7 @@ class myAbility extends Ability {
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
### disableWindowDecor()<sup>9+</sup>
...
...
@@ -6453,12 +6466,13 @@ disableWindowDecor(): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
disableWindowDecor
'
);
windowStage
.
disableWindowDecor
();
}
}
}
;
```
### setShowOnLockScreen()<sup>9+</sup>
...
...
@@ -6492,6 +6506,7 @@ setShowOnLockScreen(showOnLockScreen: boolean): void
```
ts
import
Ability
from
'
@ohos.application.Ability
'
;
class
myAbility
extends
Ability
{
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
onWindowStageCreate
'
);
...
...
@@ -6501,7 +6516,7 @@ class myAbility extends Ability {
console
.
error
(
'
Failed to show on lockscreen. Cause:
'
+
JSON
.
stringify
(
exception
));
};
}
}
}
;
```
## TransitionContext<sup>9+</sup>
...
...
@@ -6555,7 +6570,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
toWindow
.
translate
(
obj
);
console
.
info
(
'
toWindow translate end
'
);
}
)
)
;
try
{
context
.
completeTransition
(
true
)
}
catch
(
exception
)
{
...
...
@@ -6610,9 +6625,9 @@ controller.animationForShown = (context : window.TransitionContext) => {
toWindow
.
translate
(
obj
);
console
.
info
(
'
toWindow translate end
'
);
}
)
)
;
console
.
info
(
'
complete transition end
'
);
}
}
;
```
### animationForHidden<sup>9+</sup>
...
...
@@ -6658,5 +6673,5 @@ controller.animationForHidden = (context : window.TransitionContext) => {
}
)
console
.
info
(
'
complete transition end
'
);
}
}
;
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录