Skip to content

Commit

Permalink
SITES-21289: Add documentation about triggered events
Browse files Browse the repository at this point in the history
  • Loading branch information
irenelagno committed Apr 18, 2024
1 parent 08762a9 commit 413330e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pages/services/aem-universal-editor/api/commons/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,19 @@ Available data in the editor state:
| selected | `obj<string, boolean>` | {fcb38012-c4c7-51a8-896c-79e76kjk: true} | Element that is currently edited. |
| editables | `[objects]` | Array[{id: '33661..", type: 'reference', resource: "urn:..., ..}, {}] | List of elements that might be edited. The editable element object includes [proper metadata](https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/universal-editor/attributes-types). |
| location | `string` | "%locationString%" | The current page location |
| customTokens | `obj<string, string>` | {"aemconnection":""} | Custom tokens available for connections |
| customTokens | `obj<string, string>` | {"aemconnection":""} | Custom tokens available for connections |

### Triggering events from the extension in the Universal Editor

To trigger events from the extension in the Universal Editor, you can use the `guestConnection.host.remoteApp.triggerEvent`method.
This method takes the event name and the data to be passed to the event handler.

```js
import { attach } from "@adobe/uix-guest";
...
const guestConnection = await attach({ id: extensionId });

...
const newPath = "/content/we-retail/us/en";
await guestConnection.host.remoteApp.triggerEvent("extension:reloadPage", "main", newPath);
```

0 comments on commit 413330e

Please sign in to comment.