diff --git a/zh-cn/application-dev/reference/apis/js-apis-display.md b/zh-cn/application-dev/reference/apis/js-apis-display.md
index 4e6680987322cb3d837833f821b1f973592e48c4..c7cd21dfd3271e5c42884e305bacd6b870b59f25 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-display.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-display.md
@@ -94,7 +94,7 @@ try {
displayClass = display.getDefaultDisplaySync();
} catch (exception) {
console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
-};
+}
```
## display.getAllDisplays9+
@@ -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(deprecated)
@@ -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));
-});
+}
```
### getCutoutInfo9+
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));
-});
+}
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md
index 162f75d0804a942d1d97097dbfcc6c006a7b63fb..a0a82cbf7ff47911534159971440dd6df3823450 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-window.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-window.md
@@ -339,7 +339,7 @@ try {
});
} catch (exception) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.createWindow9+
@@ -386,7 +386,7 @@ try {
});
} catch (exception) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.findWindow9+
@@ -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.getLastWindow9+
@@ -458,7 +459,7 @@ try {
});
} catch (exception) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.getLastWindow9+
@@ -504,7 +505,7 @@ try {
});
} catch (exception) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.minimizeAll9+
@@ -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. Cause: ' + JSON.stringify(exception));
-};
+ console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
+}
```
## window.minimizeAll9+
@@ -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. Cause: ' + JSON.stringify(exception));
-};
+ console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
+}
```
## window.toggleShownStateForAllAppWindows9+
@@ -644,7 +642,7 @@ window.toggleShownStateForAllAppWindows((err) => {
return;
}
console.info('Succeeded in toggling shown state for all app windows.');
-})
+});
```
## window.toggleShownStateForAllAppWindows9+
@@ -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.setWindowLayoutMode9+
@@ -718,7 +716,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.setWindowLayoutMode9+
@@ -762,7 +760,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.on('systemBarTintChange')8+
@@ -791,7 +789,7 @@ try {
});
} catch (exception) {
console.error('Failed to enable the listener for systemBarTint changes. Cause: ' + JSON.stringify(exception));
-};
+}
```
## window.off('systemBarTintChange')8+
@@ -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(deprecated)
@@ -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(deprecated)
@@ -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.');
-})
+});
```
### hide7+
@@ -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));
-})
+});
```
### hideWithAnimation9+
@@ -1295,7 +1293,7 @@ windowClass.hideWithAnimation((err) => {
return;
}
console.info('Succeeded in hiding the window with animation.');
-})
+});
```
### hideWithAnimation9+
@@ -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));
-})
+});
```
### showWindow9+
@@ -1437,7 +1435,7 @@ windowClass.showWithAnimation((err) => {
return;
}
console.info('Succeeded in showing the window with animation.');
-})
+});
```
### showWithAnimation9+
@@ -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));
-})
+});
```
### destroyWindow9+
@@ -1509,7 +1507,7 @@ windowClass.destroyWindow((err) => {
return;
}
console.info('Succeeded in destroying the window.');
-})
+});
```
### destroyWindow9+
@@ -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));
-})
+});
```
### moveWindowTo9+
@@ -1584,7 +1582,7 @@ try {
});
} catch (exception) {
console.error('Failed to move the window. Cause:' + JSON.stringify(exception));
-};
+}
```
### moveWindowTo9+
@@ -1629,7 +1627,7 @@ try {
});
} catch (exception) {
console.error('Failed to move the window. Cause:' + JSON.stringify(exception));
-};
+}
```
### resize9+
@@ -1676,7 +1674,7 @@ try {
});
} catch (exception) {
console.error('Failed to change the window size. Cause:' + JSON.stringify(exception));
-};
+}
```
### resize9+
@@ -1727,7 +1725,7 @@ try {
});
} catch (exception) {
console.error('Failed to change the window size. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowMode9+
@@ -1770,7 +1768,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window mode. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowMode9+
@@ -1809,7 +1807,7 @@ setWindowMode(mode: WindowMode): Promise<void>
```js
let mode = window.WindowMode.FULLSCREEN;
try {
- let promise = windowClass.setWindowMode(type);
+ let promise = windowClass.setWindowMode(mode);
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));
-};
+}
```
### getWindowProperties9+
@@ -1849,7 +1847,7 @@ try {
let properties = windowClass.getWindowProperties();
} catch (exception) {
console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception));
-};
+}
```
### getWindowAvoidArea9+
@@ -1888,7 +1886,7 @@ try {
let avoidArea = windowClass.getWindowAvoidArea(type);
} catch (exception) {
console.error('Failed to obtain the area. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowLayoutFullScreen9+
@@ -1929,7 +1927,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowLayoutFullScreen9+
@@ -1974,7 +1972,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowSystemBarEnable9+
@@ -2016,7 +2014,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowSystemBarEnable9+
@@ -2062,7 +2060,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowSystemBarProperties9+
@@ -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));
-};
+}
```
### setWindowSystemBarProperties9+
@@ -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));
-};
+}
```
### setPreferredOrientation9+
@@ -2200,7 +2198,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window orientation. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setPreferredOrientation9+
@@ -2244,7 +2242,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window orientation. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setUIContent9+
@@ -2284,7 +2282,7 @@ try {
});
} catch (exception) {
console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
-};
+}
```
### setUIContent9+
@@ -2328,7 +2326,7 @@ try {
});
} catch (exception) {
console.error('Failed to load the content. Cause: ' + JSON.stringify(exception));
-};
+}
```
### loadContent9+
@@ -2374,7 +2372,7 @@ try {
});
} catch (exception) {
console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
-};
+}
```
### loadContent9+
@@ -2424,7 +2422,7 @@ try {
});
} catch (exception) {
console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
-};
+}
```
### isWindowShowing9+
@@ -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')7+
@@ -2484,7 +2482,7 @@ try {
});
} catch (exception) {
console.error('Failed to enable the listener for window size changes. Cause: ' + JSON.stringify(exception));
-};
+}
```
### off('windowSizeChange')7+
@@ -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')9+
@@ -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')9+
@@ -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')7+
@@ -2589,7 +2587,7 @@ try {
});
} catch (exception) {
console.error('Failed to enable the listener for keyboard height changes. Cause: ' + JSON.stringify(exception));
-};
+}
```
### off('keyboardHeightChange')7+
@@ -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')9+
@@ -2643,7 +2641,7 @@ try {
});
} catch (exception) {
console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
-};
+}
```
### off('touchOutside')9+
@@ -2670,7 +2668,7 @@ try {
windowClass.off('touchOutside');
} catch (exception) {
console.error('Failed to unregister callback. Cause: ' + JSON.stringify(exception));
-};
+}
```
### on('screenshot')9+
@@ -2697,7 +2695,7 @@ try {
});
} catch (exception) {
console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
-};
+}
```
### off('screenshot')9+
@@ -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')9+
@@ -2759,7 +2757,7 @@ try {
});
} catch (exception) {
console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
-};
+}
```
### off('dialogTargetTouch')9+
@@ -2784,7 +2782,7 @@ try {
windowClass.off('dialogTargetTouch');
} catch (exception) {
console.error('Failed to unregister callback. Cause: ' + JSON.stringify(exception));
-};
+}
```
### bindDialogTarget9+
@@ -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));
-};
+}
```
### bindDialogTarget9+
@@ -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));
-};
+}
```
### isWindowSupportWideGamut9+
@@ -3024,7 +3028,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window colorspace. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowColorSpace9+
@@ -3067,7 +3071,7 @@ try {
});
} catch (exception) {
console.error('Failed to set window colorspace. Cause:' + JSON.stringify(exception));
-};
+}
```
### getWindowColorSpace9+
@@ -3128,7 +3132,7 @@ try {
windowClass.setWindowBackgroundColor(color);
} catch (exception) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowBrightness9+
@@ -3169,7 +3173,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowBrightness9+
@@ -3214,7 +3218,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowFocusable9+
@@ -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));
-};
+}
```
### setWindowFocusable9+
@@ -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));
-};
+}
```
### setWindowKeepScreenOn9+
@@ -3341,7 +3345,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowKeepScreenOn9+
@@ -3386,7 +3390,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWakeUpScreen()9+
@@ -3422,7 +3426,7 @@ try {
windowClass.setWakeUpScreen(wakeUp);
} catch (exception) {
console.error('Failed to wake up the screen. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setWindowPrivacyMode9+
@@ -3464,7 +3468,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowPrivacyMode9+
@@ -3510,7 +3514,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### setSnapshotSkip9+
@@ -3583,7 +3587,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
-};
+}
```
### setWindowTouchable9+
@@ -3628,7 +3632,7 @@ try {
});
} catch (exception) {
console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
-};
+}
```
### setForbidSplitMove9+
@@ -3671,7 +3675,7 @@ try {
});
} catch (exception) {
console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### setForbidSplitMove9+
@@ -3718,7 +3722,7 @@ try {
});
} catch (exception) {
console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
-};
+}
```
### snapshot9+
@@ -3822,7 +3826,7 @@ try {
windowClass.opacity(0.5);
} catch (exception) {
console.error('Failed to opacity. Cause: ' + JSON.stringify(exception));
-};
+}
```
### scale9+
@@ -3863,7 +3867,7 @@ try {
windowClass.scale(obj);
} catch (exception) {
console.error('Failed to scale. Cause: ' + JSON.stringify(exception));
-};
+}
```
### rotate9+
@@ -3905,7 +3909,7 @@ try {
windowClass.rotate(obj);
} catch (exception) {
console.error('Failed to rotate. Cause: ' + JSON.stringify(exception));
-};
+}
```
### translate9+
@@ -3945,7 +3949,7 @@ try {
windowClass.translate(obj);
} catch (exception) {
console.error('Failed to translate. Cause: ' + JSON.stringify(exception));
-};
+}
```
### getTransitionController9+
@@ -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));
-})
+});
```
### setBlur9+
@@ -4042,7 +4046,7 @@ try {
windowClass.setBlur(4.0);
} catch (exception) {
console.error('Failed to set blur. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setBackdropBlur9+
@@ -4077,7 +4081,7 @@ try {
windowClass.setBackdropBlur(4.0);
} catch (exception) {
console.error('Failed to set backdrop blur. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setBackdropBlurStyle9+
@@ -4112,7 +4116,7 @@ try {
windowClass.setBackdropBlurStyle(window.BlurStyle.THIN);
} catch (exception) {
console.error('Failed to set backdrop blur style. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setShadow9+
@@ -4150,7 +4154,7 @@ try {
windowClass.setShadow(4.0, '#FF00FF00', 2, 3);
} catch (exception) {
console.error('Failed to set shadow. Cause: ' + JSON.stringify(exception));
-};
+}
```
### setCornerRadius9+
@@ -4185,7 +4189,7 @@ try {
windowClass.setCornerRadius(4.0);
} catch (exception) {
console.error('Failed to set corner radius. Cause: ' + JSON.stringify(exception));
-};
+}
```
### show(deprecated)
@@ -4215,7 +4219,7 @@ windowClass.show((err) => {
return;
}
console.info('Succeeded in showing the window.');
-})
+});
```
### show(deprecated)
@@ -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(deprecated)
@@ -4274,7 +4278,7 @@ windowClass.destroy((err) => {
return;
}
console.info('Succeeded in destroying the window.');
-})
+});
```
### destroy(deprecated)
@@ -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(deprecated)
@@ -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(deprecated)
@@ -5144,7 +5147,7 @@ windowClass.isSupportWideGamut((err, data) => {
return;
}
console.info('Succeeded in checking whether the window support WideGamut Data: ' + JSON.stringify(data));
-})
+});
```
### isSupportWideGamut(deprecated)
@@ -5204,7 +5207,7 @@ windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
return;
}
console.info('Succeeded in setting window colorspace.');
-})
+});
```
### setColorSpace(deprecated)
@@ -5269,7 +5272,7 @@ windowClass.getColorSpace((err, data) => {
return;
}
console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data));
-})
+});
```
### getColorSpace(deprecated)
@@ -5667,7 +5670,7 @@ windowClass.setOutsideTouchable(true, (err) => {
return;
}
console.info('Succeeded in setting the area to be touchable.');
-})
+});
```
### setOutsideTouchable(deprecated)
@@ -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));
});
}
-}
+};
```
### getMainWindow9+
@@ -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));
});
}
-}
+};
```
### getMainWindowSync9+
@@ -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));
};
}
-}
+};
```
### createSubWindow9+
@@ -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));
};
}
-}
+};
```
### createSubWindow9+
@@ -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));
};
}
-}
+};
```
### getSubWindow9+
@@ -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));
});
}
-}
+};
```
### getSubWindow9+
@@ -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));
})
}
-}
+};
```
### loadContent9+
@@ -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));
};
}
-}
+};
```
### loadContent9+
@@ -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));
};
}
-}
+};
```
### loadContent9+
@@ -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')9+
@@ -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')9+
@@ -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()9+
@@ -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()9+
@@ -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));
};
}
-}
+};
```
## TransitionContext9+
@@ -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');
-}
+};
```
### animationForHidden9+
@@ -6658,5 +6673,5 @@ controller.animationForHidden = (context : window.TransitionContext) => {
}
)
console.info('complete transition end');
-}
+};
```