Skip to content

Commit

Permalink
Makes params event more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn committed Nov 21, 2024
1 parent 6a20784 commit b0c4ddc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions container/src/constants/event-type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
// TODO: Add and extend event to include custom typings/interface to make it easier to use on the listener parameter
export interface ParamsEvent extends Event {} // eslint-disable-line @typescript-eslint/no-empty-object-type
/**
* ParamsEvent interface is used to make the handling of listener parameter easier
*/
export interface ParamsEvent extends Event {
[key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}

/**
* PathExistsEvent interface is used to make it easier to use the linkManager().pathExists() promise based function
* on the core application side.
* It enforces the use of the callback function, since the latter is hardcoded to be 'callback'.
* This allows to send back the boolean value if the path exists or not.
* Example Usage:
* addEventListener('my-event-id' event: PathExistsEvent => {
* addEventListener('my-event-id', event: PathExistsEvent => {
* event.callback(true);
* }
* };
Expand Down
8 changes: 6 additions & 2 deletions container/typings/constants/event-type.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// TODO: Add and extend event to include custom typings/interface to make it easier to use on the listener parameter
export interface ParamsEvent extends Event {}
/**
* ParamsEvent interface is used to make the handling of listener parameter easier
*/
export interface ParamsEvent extends Event {
[key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}

/**
* PathExistsEvent interface is used to make it easier to use the `linkManager().pathExists()` promise based function
Expand Down

0 comments on commit b0c4ddc

Please sign in to comment.