This parameter is optional, so compatibility shouldn't be affected. Each SLMessage can set its own sender ID which is present on the returned message. This allows callers to fire multiple requests at once, even of the same type, while being able to identify which response went with which request. If not specified, the default value is 0. Also went ahead and documented some of the helper functions present on SLMessage (so, available on all message instances). Finally, since I was in and messing with each message anyway, I simplified and removed some repeated code from each derived message and had it call into the super to take advantage of shared decoding functionality. The lambdas ("arrow functions") in test functions were removed per advice from Mocha's documentation where the implicit `this` rebinding can apparently cause problems. This should probably have been its own commit, but, again, I was already in there messing with stuff, so...oh well. Closes #43
16 lines
371 B
JavaScript
16 lines
371 B
JavaScript
'use strict';
|
|
|
|
const ScreenLogic = require('../index');
|
|
|
|
// you'll need a ScreenLogic-enabled device on your network for this to succeed
|
|
describe('Finder', function() {
|
|
it('finds a server', function(done) {
|
|
let finder = new ScreenLogic.FindUnits();
|
|
finder.on('serverFound', server => {
|
|
finder.close();
|
|
done();
|
|
});
|
|
finder.search();
|
|
});
|
|
});
|