-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
33 lines (27 loc) · 850 Bytes
/
test.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
var EventPipe = require('./eventpipe.js').EventPipe;
var ep = new EventPipe();
ep.setMaxListeners(20);
function print_rest(s) {
var _s = s.split(' ');
console.log(s);
return [ _s.slice(1).join(' ') ];
}
function return_false() {
return false;
}
function return_nothing(s) {
console.log(s);
}
ep.on('log', print_rest, 10);
ep.on('log', print_rest, 20);
ep.on('log', print_rest, 30);
ep.on('log', print_rest, 40);
ep.on('log', print_rest, 80);
ep.on('log', print_rest, 90);
ep.on('log', print_rest); // Default priority is 50
ep.on('log', print_rest); // Default priority is 50
ep.on('log', return_nothing, 15);
ep.on('log', return_false, 55);
ep.once('log', function() { console.log("ONCE"); }, 0);
ep.emit('log', 'The Quick Brown Fox Jumps Over the Lazy Dog');
ep.emit('log', 'The Quick Brown Fox Jumps Over the Lazy Dog');