Skip to content

Commit

Permalink
Reformatting example with some color.
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Sep 4, 2011
1 parent f1bc5f8 commit 930b150
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions examples/spy.js
@@ -1,14 +1,16 @@
var upnp = require('../lib/upnp');
var util = require('util');
var log = function(event) {
return function(device) {
console.log('UPNP Event %s: %s, %s', event, device.nt || device.st, device.usn);
};
};
var upnp = require('../')
, inspect = require('util').inspect
, log = function(event) {
return function(device) {
console.log('UPNP Event: \033[33m%s\033[39m', event)
console.log(inspect(device, true, 10, true))
console.log()
}
}

cp = new upnp.ControlPoint();
cp.on('DeviceAvailable', log('DeviceAvailable'));
cp.on('DeviceUpdated', log('DeviceUpdated'));
cp.on('DeviceUnavailable', log('DeviceUnavailable'));
cp.on('DeviceFound', log('DeviceFound'));
cp.search();
cp = new upnp.ControlPoint()
cp.on('DeviceAvailable', log('DeviceAvailable'))
cp.on('DeviceUpdated', log('DeviceUpdated'))
cp.on('DeviceUnavailable', log('DeviceUnavailable'))
cp.on('DeviceFound', log('DeviceFound'))
cp.search()

0 comments on commit 930b150

Please sign in to comment.