2023-10-24 10:57:17 -04:00
|
|
|
import { Emitter } from 'strict-event-emitter'
|
|
|
|
import { Project } from '../../../../types/project'
|
2023-11-23 07:03:22 -05:00
|
|
|
import { PermissionsLevel } from '@/features/ide-react/types/permissions'
|
2023-10-26 04:57:00 -04:00
|
|
|
import { ShareJsDoc } from '@/features/ide-react/editor/share-js-doc'
|
2023-10-24 10:57:17 -04:00
|
|
|
import { GotoLineOptions } from '@/features/ide-react/types/goto-line-options'
|
|
|
|
import { CursorPosition } from '@/features/ide-react/types/cursor-position'
|
2023-11-02 07:36:04 -04:00
|
|
|
import { FileTreeFindResult } from '@/features/ide-react/types/file-tree'
|
2023-10-24 10:57:17 -04:00
|
|
|
|
|
|
|
export type IdeEvents = {
|
|
|
|
'project:joined': [{ project: Project; permissionsLevel: PermissionsLevel }]
|
2023-10-26 04:57:00 -04:00
|
|
|
'document:closed': [doc: ShareJsDoc]
|
|
|
|
'doc:changed': [{ doc_id: string }]
|
|
|
|
'doc:saved': [{ doc_id: string }]
|
|
|
|
'doc:opened': []
|
|
|
|
'ide:opAcknowledged': [{ doc_id: string; op: any }]
|
|
|
|
'store-doc-position': []
|
2023-10-24 10:57:17 -04:00
|
|
|
'editor:gotoOffset': [gotoOffset: number]
|
|
|
|
'editor:gotoLine': [options: GotoLineOptions]
|
|
|
|
'cursor:editor:update': [position: CursorPosition]
|
2023-10-26 04:57:00 -04:00
|
|
|
'outline-toggled': [isOpen: boolean]
|
2023-10-24 10:57:17 -04:00
|
|
|
'cursor:editor:syncToPdf': []
|
|
|
|
'scroll:editor:update': []
|
|
|
|
'comment:start_adding': []
|
2023-10-26 04:57:00 -04:00
|
|
|
'references:should-reindex': []
|
2023-11-28 06:24:23 -05:00
|
|
|
'history:toggle': []
|
2023-11-02 07:36:04 -04:00
|
|
|
'entity:deleted': [entity: FileTreeFindResult]
|
2023-10-24 10:57:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export type IdeEventEmitter = Emitter<IdeEvents>
|
|
|
|
|
|
|
|
export function createIdeEventEmitter(): IdeEventEmitter {
|
|
|
|
return new Emitter<IdeEvents>()
|
|
|
|
}
|