未验证 提交 af76f278 编写于 作者: O openharmony_ci 提交者: Gitee

!9554 翻译完成:9282+9457+9306+9477

Merge pull request !9554 from wusongqing/TR9282
......@@ -26,7 +26,7 @@ Callback of the common event of a static subscriber.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | CommonEventData | Yes| Common event of a static subscriber.|
| event | [CommonEventData](js-apis-commonEvent.md#commoneventdata) | Yes| Common event of a static subscriber.|
**Example**
......
......@@ -9,10 +9,10 @@ The **EventHub** module provides APIs to subscribe to, unsubscribe from, and tri
## Usage
Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance.
Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance.
```js
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability {
func1(){
console.log("func1 is called");
......@@ -34,15 +34,15 @@ Subscribes to an event.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| callback | Function | Yes| Callback invoked when the event is triggered.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| callback | Function | Yes| Callback invoked when the event is triggered.|
**Example**
```js
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability {
onForeground() {
......@@ -72,15 +72,15 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.|
**Example**
```js
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability {
onForeground() {
......@@ -110,15 +110,15 @@ Triggers an event.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| Event name.|
| ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.|
**Example**
```js
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.application.Ability';
export default class MainAbility extends Ability {
onForeground() {
......
......@@ -17,7 +17,9 @@ import windowAnimationManager from '@ohos.animation.windowAnimationManager'
setController(controller: WindowAnimationController): void
Sets a window animation controller.
Sets a window animation controller. For details about the controller, see [WindowAnimationController](#windowanimationcontroller).
Before using other APIs of **windowAnimationManager**, you must call this API to set a window animation controller.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -31,22 +33,38 @@ Sets a window animation controller.
```js
var controller = {
onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher', startingWindowTarget);
},
onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent', startingWindowTarget);
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther', startingWindowTarget);
onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
},
onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
},
onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
},
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
},
onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
}
}
......@@ -73,9 +91,39 @@ Minimizes the window that displays the animation. This API uses an asynchronous
```js
var target: WindowAnimationTarget = undefined;
var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void {
target = fullScreenWindowTarget;
},
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
},
onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
},
onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
},
onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
},
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
}
}
windowAnimationManager.setController(controller)
......@@ -119,9 +167,39 @@ Minimizes the window that displays the animation. This API uses a promise to ret
```js
var target: WindowAnimationTarget = undefined;
var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void {
target = fullScreenWindowTarget;
},
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
},
onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget);
console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget);
finishCallback.onAnimationFinish();
},
onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget);
finishCallback.onAnimationFinish();
},
onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget);
finishCallback.onAnimationFinish();
},
onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock called');
finishCallback.onAnimationFinish();
},
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void{
console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget);
console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets);
}
}
windowAnimationManager.setController(controller)
......@@ -137,7 +215,7 @@ promise.then((data) => {
## WindowAnimationController
Implements the window animation controller.
Implements the window animation controller. When creating a **WindowAnimationController** object, you must implement all callbacks in the object.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -156,13 +234,7 @@ Called when an application is started from the home screen.
**Example**
```js
var controller = {
onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher', startingWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onStartAppFromRecent
......@@ -179,13 +251,7 @@ Called when an application is started from the recent task list.
**Example**
```js
var controller = {
onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromRecent', startingWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onStartAppFromOther
......@@ -202,13 +268,7 @@ Called when an application is started from a place other than the home screen an
**Example**
```js
var controller = {
onStartAppFromOther(startingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onStartAppFromOther', startingWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onAppTransition
......@@ -226,14 +286,7 @@ Called during application transition.
**Example**
```js
var controller = {
onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,
finishCallback: WindowAnimationFinishedCallback): void {
console.log('onAppTransition', fromWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onMinimizeWindow
......@@ -250,13 +303,7 @@ Called when a window is minimized.
**Example**
```js
var controller = {
onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onMinimizeWindow', minimizingWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onCloseWindow
......@@ -273,13 +320,7 @@ Called when a window is closed.
**Example**
```js
var controller = {
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
console.log('onCloseWindow', closingWindowTarget);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onScreenUnlock
......@@ -295,13 +336,7 @@ Called when the screen is unlocked.
**Example**
```js
var controller = {
onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void {
console.log('onScreenUnlock'.);
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
### onWindowAnimationTargetsUpdate
......@@ -318,15 +353,7 @@ Called when the window that displays the animation is updated.
**Example**
```js
var controller = {
onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void {
console.log('onWindowAnimationTargetsUpdate'.);
}
}
windowAnimationManager.setController(controller)
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
## WindowAnimationFinishedCallback
Implements a callback that is invoked when the animation is finished.
......@@ -341,13 +368,7 @@ Called when the animation is finished.
**Example**
```js
var controller = {
onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void {
finishCallback.onAnimationFinish();
}
}
```
For details, see the sample code under [windowAnimationManager.setController](#windowanimationmanagersetcontroller).
## WindowAnimationTarget
Defines a window to display animation.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册