mirror of
https://github.com/gundb/panic-server.git
synced 2026-01-13 23:37:54 -05:00
filters/exclusions, all tests passing. Eslint came with these nasty notions about alphabetizing your variable definitions. Strict enforcement has been enabled, and empty functions are now allowed (noop, and it was causing noise while developing). The tests are now using mocha instead of jasmine, as I'm trying to become more familiar with it. The clientList is now dynamically controlled. Only connected peers are shown, and add/remove events are fired as things change. You can now filter a client set against criteria (platform, generic callback) and return a new list of live updating clients, subscribed to changes on the parent list. There's some syntax sugar also. You can create a list that excludes another set, such as a list of browsers might be everything that isn't a Node.js platform. You'd write that as an exclusion. Added some basic tests for the clientList and mock logic.
16 lines
270 B
JavaScript
16 lines
270 B
JavaScript
'use strict';
|
|
var Emitter = require('events');
|
|
|
|
function Client(platform) {
|
|
this.socket = new Emitter();
|
|
this.socket.connected = true;
|
|
this.socket.id = Math.random()
|
|
.toString(36)
|
|
.slice(2);
|
|
this.platform = platform || {};
|
|
}
|
|
|
|
module.exports = {
|
|
Client: Client
|
|
};
|