Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Connection(req, socket, upgradeHeader) {
EventEmitter.call(this);
var headers = this.headers = this.request(req);
this.version = -1;
this.socket = socket;
this.bytesSend = 0;
this.bytesReceived = 0;
this.rawBytesSend = 0;
this.rawBytesReceived = 0;
this.connected = false;
// Newer drafts
if ('version' in headers && 'origin' in headers) {
if (this.headers.version === 8) {
function Beam(config){
EventEmitter.call(this);
var beam = this;
var noconfig = (typeof config === 'function');
var worklist = Array.prototype.slice.call(arguments).slice(noconfig?0:1);
var config = noconfig?{}:(config || {});
beam.config = config;
var id = config.id || Date.now().toString(36)+Math.round(Math.random()*10).toString(36);
Object.defineProperty(beam,"id",{
enumerable : true,
get : function(){return id;},
set : function(set){
beam.emit("idUpdate",id,set);
id = set;
}
});
var StdIOConnection = exports.StdIOConnection = function(command, options) {
var command_parts = command.split(' ');
command = command_parts[0];
var args = command_parts.splice(1,command_parts.length -1);
var child = this.child = child_process.spawn(command,args);
var self = this;
EventEmitter.call(this);
this.connection = child.stdin;
this.options = options || {};
this.transport = this.options.transport || TBufferedTransport;
this.protocol = this.options.protocol || TBinaryProtocol;
this.offline_queue = [];
if (log.getLogLevel() === 'debug') {
this.child.stderr.on('data', function (err) {
log.debug(err.toString(), 'CHILD ERROR');
});
this.child.on('exit', function (code,signal) {
log.debug(code + ':' + signal, 'CHILD EXITED');
});
}
constructor: function(options) {
EventEmitter.call(this);
this.headerList = [];
_.extend(this, _.pick(options, optionKeys));
if (!this.timestamp) {
this.timestamp = new Date();
}
if (_.has(options, 'headers')) {
this.addHeaders(options.headers);
}
},
function WorkerPool(size, worker) {
if (!(this instanceof WorkerPool)) return new WorkerPool(size, worker);
EventEmitter.call(this);
this.__workers = [];
this.__wClass = worker;
this.__size = 0;
this.update = _.debounce(() => {
process.nextTick(() => {
this.resize();
this.gc();
});
}, 100, { maxWait: 200 });
this.resize(size);
}
var Scheduler = module.exports = function(manualStart){
this.sequences = [];
this.currentSequence = null;
this.active = false; //true when running a sequence
this.started = false;
EventEmitter.call(this);
if(!manualStart)
this.start();
}
function Content() {
EventEmitter.call(this);
this.readable = true;
setupContent(this);
}
function SourceManager() {
if (! (this instanceof SourceManager)) return new SourceManager();
this.sources = [];
eventEmitter.call(this);
}
function BufferSlicer(buffer) {
EventEmitter.call(this);
this.refCount = 0;
this.buffer = buffer;
}
function Client(options) {
var self = this;
EE.call(this);
this.watchmanBinaryPath = 'watchman';
if (options && options.watchmanBinaryPath) {
this.watchmanBinaryPath = options.watchmanBinaryPath.trim();
};
this.commands = [];
}
util.inherits(Client, EE);