-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(editor): Type node view event bus
Builds on top of #10367
- Loading branch information
Showing
1 changed file
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
import type { EventBus } from 'n8n-design-system/utils'; | ||
import { createEventBus } from 'n8n-design-system/utils'; | ||
import type { IDataObject } from 'n8n-workflow'; | ||
|
||
export const nodeViewEventBus = createEventBus(); | ||
export type CallbackFn = () => void; | ||
|
||
export interface NodeViewEventBusEvents { | ||
/** Command to create a new workflow */ | ||
newWorkflow: never; | ||
|
||
/** Command to open the chat */ | ||
openChat: never; | ||
|
||
/** Command to save the current workflow */ | ||
saveWorkflow: CallbackFn; | ||
|
||
/** Command to import a workflow from given data */ | ||
importWorkflowData: IDataObject; | ||
|
||
/** Command to import a workflow from given URL */ | ||
importWorkflowUrl: IDataObject; | ||
|
||
'runWorkflowButton:mouseenter': never; | ||
|
||
'runWorkflowButton:mouseleave': never; | ||
} | ||
|
||
export type NodeViewEventBus = EventBus<NodeViewEventBusEvents>; | ||
|
||
export const nodeViewEventBus = createEventBus<NodeViewEventBusEvents>(); |