concept-collection / hitandrun-commonview
hitandrun-commonview / src / engine / protocol.ts
18 lines · 801 BBlameHistoryRaw
1// Messages between the engine host (main thread) and the numbl worker.
3import type {ProjectFile} from './project'
5export type ToWorker =
6 | {type: 'run'; files: ProjectFile[]; mainFileName: string}
7 // An HTML→MATLAB event: fires the script's HTMLEventReceivedFcn.
8 | {type: 'event'; compId: string; name: string; data: unknown}
10export type FromWorker =
11 // A uihtml component was created (or re-shown): its id and initial Data.
12 | {type: 'uihtml'; compId: string; dataJson: string | undefined}
13 // The script called sendEventToHTMLSource(src, name, data).
14 | {type: 'hostEvent'; compId: string; name: string; dataJson: string}
15 | {type: 'output'; text: string}
16 | {type: 'runDone'; hasSession: boolean}
17 | {type: 'runError'; message: string}
18 | {type: 'eventError'; message: string}