-
Notifications
You must be signed in to change notification settings - Fork 4
/
workflows.class.js
44 lines (42 loc) · 1.23 KB
/
workflows.class.js
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
var nodejs = false;
try {
if ( window !== this )
nodejs = true;
} catch (e) {
nodejs = true;
}
var Workflows = {}
Workflows.receiver = {
'waiting-transfert': {
enq: ['Transfert accepted', 'ack', 'waiting-message'],
nak: ['Transfert refused', 'nak', 'waiting-transfert']
},
'waiting-message': {
stx: ['Message recieved', null, 'validating-message'],
eot: ['Transfert closed', null, 'waiting-transfert']
},
'validating-message': {
ack: ['Message accepted', 'ack', 'stopping-transfert'],
nak: ['Message refused', 'nak', 'waiting-message']
},
'stopping-transfert': {
eot: ['Transfert terminated', null, 'waiting-transfert']
}
}
Workflows.sender = {
'waiting-start': {
null: ['Opening Transfert', 'enq', 'waiting-transfert']
},
'waiting-transfert': {
ack: ['Sending message', 'stx', 'waiting-reception'],
nak: ['Transfert refused', 'eot', 'waiting-start']
},
'waiting-reception': {
ack: ['Message accepted, terminating', 'eot', 'waiting-start'],
nak: ['Message refused, terminating', 'eot', 'waiting-start']
}
}
if ( nodejs )
{
exports.getWorkflows = function(){ return Workflows; }
}