Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit e736d4f
Author: Justin Gordon <[email protected]>
Date:   Sun Aug 21 16:26:50 2016 -1000

    Address linting issues (#528)

    * fixed linting for 6.1
  • Loading branch information
lucke84 committed Aug 22, 2016
1 parent bb0eb2f commit 0f6f382
Showing 1 changed file with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
var net = require('net');
var fs = require('fs');
const net = require('net');
const fs = require('fs');

var bundlePath = '../../app/assets/webpack/';
var bundleFileName = 'webpack-bundle.js';
const bundlePath = '../../app/assets/webpack/';
let bundleFileName = 'webpack-bundle.js';

var currentArg;
let currentArg;

function Handler() {
this.queue = [];
this.initialized = false;
}

Handler.prototype.handle = function (connection) {
var callback = function () {
Handler.prototype.handle = (connection) => {
const callback = () => {
connection.setEncoding('utf8');
connection.on('data', (data)=> {
console.log('Processing request: ' + data);
var result = eval(data);
connection.on('data', (data) => {
console.log(`Processing request: ${data}`);

// eslint-disable-next-line no-eval
const result = eval(data);
connection.write(result);
});
};
Expand All @@ -28,33 +30,35 @@ Handler.prototype.handle = function (connection) {
}
};

Handler.prototype.initialize = function () {
console.log('Processing ' + this.queue.length + ' pending requests');
var callback;
Handler.prototype.initialize = () => {
console.log(`Processing ${this.queue.length} pending requests`);
let callback;

// eslint-disable-next-line no-cond-assign
while (callback = this.queue.pop()) {
callback();
}

this.initialized = true;
};

var handler = new Handler();
const handler = new Handler();

process.argv.forEach((val) => {
if (val[0] == '-') {
if (val[0] === '-') {
currentArg = val.slice(1);
return;
}

if (currentArg == 's') {
if (currentArg === 's') {
bundleFileName = val;
}
});

try {
fs.mkdirSync(bundlePath);
} catch (e) {
if (e.code != 'EEXIST') throw e;
if (e.code !== 'EEXIST') throw e;
}

fs.watchFile(bundlePath + bundleFileName, (curr) => {
Expand All @@ -64,13 +68,14 @@ fs.watchFile(bundlePath + bundleFileName, (curr) => {
return;
}

// eslint-disable-next-line global-require
require(bundlePath + bundleFileName);
console.log('Loaded server bundle: ' + bundlePath + bundleFileName);
console.log(`Loaded server bundle: ${bundlePath + bundleFileName}`);
handler.initialize();
}
});

var unixServer = net.createServer(function (connection) {
const unixServer = net.createServer((connection) => {
handler.handle(connection);
});

Expand Down

0 comments on commit 0f6f382

Please sign in to comment.