Skip to content

Commit

Permalink
refactor: Change TabEvent to object literal, add TabEventMap (#2191)
Browse files Browse the repository at this point in the history
Add TabEventMap assiciating TabEvent types to callback signatures.
Change TabEvent to object literal so it could be used to define
TabEventMap.

BREAKING CHANGE: Delete unused event types: `openPQObject`,
`openControl`, `reload`, `clearAllFilters`.
  • Loading branch information
vbabich committed Aug 20, 2024
1 parent f5b01fd commit 419f95d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
17 changes: 4 additions & 13 deletions packages/dashboard-core-plugins/src/events/TabEvent.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
class TabEvent {
static focus = 'TabEvent.focus';

static blur = 'TabEvent.blur';

static openPQObject = 'TabEvent.openPQObject';

static openControl = 'TabEvent.openControl';

static reload = 'TabEvent.reload';

static clearAllFilters = 'TabEvent.clearAllFilters';
}
const TabEvent = Object.freeze({
focus: 'TabEvent.focus',
blur: 'TabEvent.blur',
});

export default TabEvent;
12 changes: 12 additions & 0 deletions packages/dashboard-core-plugins/src/events/TabEventMap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ValueOf } from '@deephaven/utils';
import TabEvent from './TabEvent';

export type TabEventType = ValueOf<typeof TabEvent>;

export interface TabEventMap
extends Record<TabEventType, (...args: never[]) => void> {
[TabEvent.focus]: () => void;
[TabEvent.blur]: () => void;
}

export default TabEventMap;

0 comments on commit 419f95d

Please sign in to comment.