Skip to content

Commit 6f3cb39

Browse files
committed
Merge remote-tracking branch 'upstream/main' into assets-view-details-extension
2 parents 92fc407 + 2f37d08 commit 6f3cb39

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
11
---
2-
title: Working with the events - Universal Editor Extensibility
3-
description: Leveraging universal editor events within your application
2+
title: Working with CustomEvent - Universal Editor Extensibility
3+
description: Communicating to the Remote Application through CustomEvent
44
contributors:
55
- https://github.com/AdobeDocs/uix
66
---
77

8-
# Working with Events
8+
# Working with Custom Events
99

10-
The Universal Editor sends defined events to remote applications. In case the remote application has no custom event listener for the sent event, a fallback event listener provided by the universal-editor-cors package is executed.
10+
The Universal Editor sends defined events to the remote application, on top of this `CustomEvent` can also be sent directly from the Extension to the remote application.
1111

12-
### Working with Events
12+
### Working with Custom Events
1313

14-
If your business logic requires sending an event to the Universal Editor, you can use the `triggerEvent` method.
15-
Here's an example of how to dispatch the `aue:ui-viewport-change` event:
14+
You can send events to the remote application using the `triggerEvent` method.
1615

1716
```js
1817
useEffect(() => {
1918
(async () => {
2019
const guestConnection = await attach({id: extensionId});
2120
...
22-
await guestConnection.host.remoteApp.triggerEvent('aue:ui-viewport-change',
23-
'main',
21+
await guestConnection.host.remoteApp.triggerEvent('my-custom-event',
22+
'body',
2423
{
25-
details: {
26-
height: 1024,
27-
width: 768,
28-
}
24+
example: 'payload'
2925
}
3026
);
3127
...
3228
})();
3329
}, []);
34-
```
30+
```
31+
32+
## API Reference
33+
34+
### TriggerEvent API
35+
36+
| Field | Type | Required | Description |
37+
| eventName | `string` | ✔️ | Name of the event |
38+
| selector | `string` | ✔️ | A valid CSS selector string|
39+
| payload | Serializable `object`| An object that, in addition of the properties defined in the Event Constructor |

0 commit comments

Comments
 (0)