mirror of
https://github.com/stashapp/stash.git
synced 2025-12-10 02:15:30 +01:00
* 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>
19 lines
403 B
TypeScript
19 lines
403 B
TypeScript
class StashEvent extends EventTarget {
|
|
dispatch(event: string, id?: string, data?: object) {
|
|
event = `stash:${event}${id ? `:${id}` : ""}`;
|
|
|
|
this.dispatchEvent(
|
|
new CustomEvent(event, {
|
|
detail: {
|
|
event: event,
|
|
...(id ? { id } : {}),
|
|
...(data ? { data } : {}),
|
|
},
|
|
})
|
|
);
|
|
}
|
|
}
|
|
|
|
const Event = new StashEvent();
|
|
|
|
export default Event;
|