-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
51 lines (42 loc) · 1.1 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var SteamController = require('./index.js');
var controller = new SteamController(1);
var presses = [
'x','y','a','b',
'home','back','forward',
'ltrigger','rtrigger',
'lgrip','rgrip',
'lshoulder','rshoulder',
'stick',
'lpad','rpad'
];
presses.forEach(function(name){
controller[name].on('press', function(ev){
console.log(name,'press',ev);
})
controller[name].on('release', function(ev){
console.log(name,'release',ev);
})
});
['ltrigger','rtrigger', 'stick', 'lpad', 'rpad'].forEach(function(name){
['move start', 'move stop', 'move'].forEach(function(type){
controller[name].on(type, function(ev){
console.log(name,type, ev);
});
});
});
['lpad','rpad'].forEach(function(name){
['touch', 'untouch'].forEach(function(type){
controller[name].on(type, function(ev){
console.log(name,type, ev);
});
});
});
['up', 'down', 'left', 'right'].forEach(function(name){
controller.lpad.on( name + ' press', function(ev){
console.log('lpad press', name, ev);
});
controller.lpad.on( name + ' release', function(ev){
console.log('lpad releases', name, ev);
});
});
controller.connect();