diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/action-event.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/action-event.context.ts new file mode 100644 index 0000000000..945fadf152 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/action/action-event.context.ts @@ -0,0 +1,13 @@ +import { UmbContextBase } from '@umbraco-cms/backoffice/class-api'; +import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; +import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; + +export class UmbActionEventContext extends UmbContextBase { + constructor(host: UmbControllerHost) { + super(host, UMB_ACTION_EVENT_CONTEXT); + } +} + +export const UMB_ACTION_EVENT_CONTEXT = new UmbContextToken( + 'UmbActionEventContext', +); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts new file mode 100644 index 0000000000..24e4901ba9 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts @@ -0,0 +1,27 @@ +export class UmbControllerEvent extends Event { + public constructor(type: string) { + super(type, { bubbles: false, composed: false, cancelable: false }); + } +} + +export interface UmbActionEventArgs { + entityType: string; + unique: string; +} + +export class UmbActionEvent extends UmbControllerEvent { + #args: UmbActionEventArgs; + + public constructor(type: string, args: UmbActionEventArgs) { + super(type); + this.#args = args; + } + + getEntityType(): string { + return this.#args.entityType; + } + + getUnique(): string { + return this.#args.unique; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts index b9a260ce0b..05f892981b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts @@ -1,2 +1,4 @@ export * from './repository-action.js'; export * from './action.interface.js'; +export * from './action-event.context.js'; +export * from './action.event.js';