Skip to content

Commit

Permalink
refactor: migrate to ES6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Jan 12, 2020
1 parent ecfcc69 commit da93fb6
Show file tree
Hide file tree
Showing 10 changed files with 4,191 additions and 1,573 deletions.
13 changes: 7 additions & 6 deletions lib/engine.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* Module dependencies.
*/

var http = require('http');
const http = require('http');
const Server = require('./server');

/**
* Invoking the library as a function delegates to attach if the first argument
Expand All @@ -25,7 +26,7 @@ exports = module.exports = function () {
}

// if first argument is not an http server, then just make a regular eio server
return exports.Server.apply(null, arguments);
return new Server(arguments);
};

/**
Expand All @@ -42,7 +43,7 @@ exports.protocol = 1;
* @api public
*/

exports.Server = require('./server');
exports.Server = Server;

/**
* Expose Socket constructor.
Expand Down Expand Up @@ -94,13 +95,13 @@ function listen (port, options, fn) {
options = {};
}

var server = http.createServer(function (req, res) {
const server = http.createServer(function (req, res) {
res.writeHead(501);
res.end('Not Implemented');
});

// create engine server
var engine = exports.attach(server, options);
const engine = exports.attach(server, options);
engine.httpServer = server;

server.listen(port, fn);
Expand All @@ -120,7 +121,7 @@ function listen (port, options, fn) {
exports.attach = attach;

function attach (server, options) {
var engine = new exports.Server(options);
const engine = new Server(options);
engine.attach(server, options);
return engine;
}
Loading

0 comments on commit da93fb6

Please sign in to comment.