-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathEvents.ts
More file actions
171 lines (152 loc) · 5.04 KB
/
Events.ts
File metadata and controls
171 lines (152 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* eslint-disable @typescript-eslint/no-useless-constructor */
import type { DebugProtocol } from 'vscode-debugprotocol';
import type { BrightScriptDebugCompileError } from '../CompileErrorProcessor';
import type { LaunchConfiguration } from '../LaunchConfiguration';
import type { ChanperfData } from '../ChanperfTracker';
import type { RendezvousHistory } from '../RendezvousTracker';
export class CustomEvent<T> implements DebugProtocol.Event {
public constructor(body: T) {
this.body = body;
this.event = this.constructor.name;
}
/**
* The body (payload) of the event.
*/
public body: T;
/**
* The name of the event. This name is how the client identifies the type of event and how to handle it
*/
public event: string;
/**
* The type of ProtocolMessage. Hardcoded to 'event' for all custom events
*/
public type = 'event';
public seq: number;
}
/**
* Emitted when compile errors were encountered during the current debug session,
* usually during the initial sideload process as the Roku is compiling the app.
*/
export class CompileFailureEvent extends CustomEvent<{ compileErrors: BrightScriptDebugCompileError[] }> {
constructor(compileErrors: BrightScriptDebugCompileError[]) {
super({ compileErrors });
}
}
/**
* Is the object a `CompileFailureEvent`
*/
export function isCompileFailureEvent(event: any): event is CompileFailureEvent {
return !!event && event.event === CompileFailureEvent.name;
}
/**
* A line of log ouptut from the Roku device
*/
export class LogOutputEvent extends CustomEvent<{ line: string }> {
constructor(line: string) {
super({ line });
}
}
/**
* Is the object a `LogOutputEvent`
*/
export function isLogOutputEvent(event: any): event is LogOutputEvent {
return !!event && event.event === LogOutputEvent.name;
}
/**
* Log output from the debug server. These are logs emitted from NodeJS from the various RokuCommunity tools
*/
export class DebugServerLogOutputEvent extends CustomEvent<{ line: string }> {
constructor(line: string) {
super({ line });
}
}
/**
* Is the object a `DebugServerLogOutputEvent`
*/
export function isDebugServerLogOutputEvent(event: any): event is DebugServerLogOutputEvent {
return !!event && event.event === DebugServerLogOutputEvent.name;
}
/**
* Emitted when a rendezvous has occurred. Contains the full history of rendezvous since the start of the current debug session
*/
export class RendezvousEvent extends CustomEvent<RendezvousHistory> {
constructor(output: RendezvousHistory) {
super(output);
}
}
/**
* Is the object a `RendezvousEvent`
*/
export function isRendezvousEvent(event: any): event is RendezvousEvent {
return !!event && event.event === RendezvousEvent.name;
}
/**
* Emitted anytime the debug session receives chanperf data.
*/
export class ChanperfEvent extends CustomEvent<ChanperfData> {
constructor(output: ChanperfData) {
super(output);
}
}
/**
* Is the object a `ChanperfEvent`
*/
export function isChanperfEvent(event: any): event is ChanperfEvent {
return !!event && event.event === ChanperfEvent.name;
}
/**
* Emitted when the launch sequence first starts. This is right after the debug session receives the `launch` request,
* which happens before any zipping, sideloading, etc.
*/
export class LaunchStartEvent extends CustomEvent<LaunchConfiguration> {
constructor(launchConfiguration: LaunchConfiguration) {
super(launchConfiguration);
}
}
/**
* Is the object a `LaunchStartEvent`
*/
export function isLaunchStartEvent(event: any): event is LaunchStartEvent {
return !!event && event.event === LaunchStartEvent.name;
}
/**
* This event indicates that the client should show a popup message with the supplied information
*/
export class PopupMessageEvent extends CustomEvent<{ message: string; severity: 'error' | 'info' | 'warn' }> {
constructor(message: string, severity: 'error' | 'info' | 'warn') {
super({ message, severity });
}
}
/**
* Is the object a `PopupMessageEvent`
*/
export function isPopupMessageEvent(event: any): event is PopupMessageEvent {
return !!event && event.event === PopupMessageEvent.name;
}
/**
* Emitted once the channel has been sideloaded to the channel and the session is ready to start actually debugging.
*/
export class ChannelPublishedEvent extends CustomEvent<{ launchConfiguration: LaunchConfiguration }> {
constructor(
launchConfiguration: LaunchConfiguration
) {
super({ launchConfiguration });
}
}
/**
* Is the object a `ChannelPublishedEvent`
*/
export function isChannelPublishedEvent(event: any): event is ChannelPublishedEvent {
return !!event && event.event === ChannelPublishedEvent.name;
}
export enum StoppedEventReason {
step = 'step',
breakpoint = 'breakpoint',
exception = 'exception',
pause = 'pause',
entry = 'entry',
goto = 'goto',
functionBreakpoint = 'function breakpoint',
dataBreakpoint = 'data breakpoint',
instructionBreakpoint = 'instruction breakpoint'
}