overleaf/services/web/frontend/js/features/ide-react/create-ide-event-emitter.ts
Alf Eaton 8cb76ce40b [ide-react] Address some migration TODOs (#16033)
* Add type for externalUpdate
* Log clientTracking.getConnectedUsers error
* Remove update debugging code
* Use ErrorMetadata type
* Use Message type
* Remove unused document:opened event

GitOrigin-RevId: 3a1d1e785dca37d6b91cd650fbcb4e5decb6343b
2023-12-06 09:04:18 +00:00

33 lines
1.3 KiB
TypeScript

import { Emitter } from 'strict-event-emitter'
import { Project } from '../../../../types/project'
import { PermissionsLevel } from '@/features/ide-react/types/permissions'
import { ShareJsDoc } from '@/features/ide-react/editor/share-js-doc'
import { GotoLineOptions } from '@/features/ide-react/types/goto-line-options'
import { CursorPosition } from '@/features/ide-react/types/cursor-position'
import { FileTreeFindResult } from '@/features/ide-react/types/file-tree'
export type IdeEvents = {
'project:joined': [{ project: Project; permissionsLevel: PermissionsLevel }]
'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': []
'editor:gotoOffset': [gotoOffset: number]
'editor:gotoLine': [options: GotoLineOptions]
'cursor:editor:update': [position: CursorPosition]
'outline-toggled': [isOpen: boolean]
'cursor:editor:syncToPdf': []
'scroll:editor:update': []
'comment:start_adding': []
'references:should-reindex': []
'history:toggle': []
'entity:deleted': [entity: FileTreeFindResult]
}
export type IdeEventEmitter = Emitter<IdeEvents>
export function createIdeEventEmitter(): IdeEventEmitter {
return new Emitter<IdeEvents>()
}