-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathevents.js
44 lines (37 loc) · 1.02 KB
/
events.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
// Events/Gestures test
//
// Activity will listen for skeleton start/stop tracking
// Also listen for left/right swipes and waves
var nuimotion = require("nuimotion");
nuimotion.addListener(
[ nuimotion.Events.SKELETON_TRACKING,
nuimotion.Events.SKELETON_STOPPED_TRACKING ],
onEvent );
nuimotion.addGesture(
[ nuimotion.Events.Gestures.Swipe.types.left,
nuimotion.Events.Gestures.Swipe.types.right,
nuimotion.Events.Gestures.Wave.types.left,
nuimotion.Events.Gestures.Wave.types.right,
nuimotion.Events.Gestures.Wave.types.any /* will not fire if left and right waves are present */ ],
onGesture);
nuimotion.init();
/**
* listen for Node process shutdown and close NUIMotion appropriately
*/
process.on('exit', function() {
nuimotion.close();
});
/**
* on general event (user/device/etc)
* @param eventType
*/
function onEvent(eventType) {
console.log(eventType);
}
/**
* on gesture event
* @param gesture
*/
function onGesture(gesture) {
console.log(gesture)
}