-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmessages.js
More file actions
30 lines (27 loc) · 791 Bytes
/
Copy pathmessages.js
File metadata and controls
30 lines (27 loc) · 791 Bytes
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
export const TERMINATE = 'TERMINATE';
export function terminate({ id }) {
return [{ type: TERMINATE, id }];
}
export const CREATE_WORKER = 'CREATE_WORKER';
export function createWorker({ id, port, args }) {
return [{ type: CREATE_WORKER, id, port, args }, [port]];
}
export const CONNECT = 'CONNECT';
export function connect({ id, port }) {
return [{ type: CONNECT, id, port }, [port]];
}
export const ERROR = 'ERROR';
export function error({ id, error: errorOrEvent }) {
return [{
type: ERROR,
id,
// Events can not be structurally cloned.
// Send properties and recreate at receiver instead.
event: {
message: errorOrEvent.message,
lineno: errorOrEvent.lineno,
colno: errorOrEvent.colno,
filename: errorOrEvent.filename
}
}];
}