Implement UI event dispatcher/listener (#4492)

* page change event
* expose event to plugin api
* Update UIPluginApi.md
* Add to example plugin
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
Raghavan
2024-02-27 03:57:28 +05:30
committed by GitHub
parent 56896d7c7d
commit 6a9175c954
5 changed files with 40 additions and 0 deletions

View File

@@ -136,3 +136,11 @@ Registers an after function. An after function is called after the render functi
| `fn` | `Function` | The after function. It accepts the same arguments as the original render function, plus the result of the original render function, and is expected to return the rendered component. |
Returns `void`.
#### `PluginApi.Event`
Allows plugins to listen for Stash's events.
```js
PluginApi.Event.addEventListener("stash:location", (e) => console.log("Page Changed", e.detail.data.location.pathname))
```