-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
40 lines (34 loc) · 888 Bytes
/
example.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
const usbDetect = require('.')
async function main() {
setTimeout(() => {
usbDetect.stopMonitoring()
}, 5000)
usbDetect.on('add', function (device) {
console.log('add', device)
})
usbDetect.on('add:10473', function (device) {
console.log('add 10473', device)
})
usbDetect.on('add:10473:394', function (device) {
console.log('add 10473:394', device)
})
usbDetect.on('remove', function (device) {
console.log('remove', device)
})
usbDetect.on('remove:10473', function (device) {
console.log('remove 10473', device)
})
usbDetect.on('remove:10473:394', function (device) {
console.log('remove 10473:394', device)
})
usbDetect.on('change', function (device) {
console.log('change', device)
})
usbDetect.startMonitoring()
const res = await usbDetect.find({
pid: 1558,
vid: 1507,
})
console.log(res)
}
main()