Skip to content

Commit 75bca73

Browse files
committed
Use prototype for the sockWrite function.
1 parent a5ddf82 commit 75bca73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/Server.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ function Server(compiler, options) {
2323
this.hot = options.hot;
2424
this.headers = options.headers;
2525

26-
this.sockWrite = function(type, data) {
27-
if (this.sock) {
28-
this.sock.write(JSON.stringify({type: type, data: data}));
29-
}
30-
}
31-
3226
// Listening for events
3327
var invalidPlugin = function() {
3428
this.sockWrite("invalid");
@@ -300,6 +294,12 @@ Server.prototype.close = function() {
300294
this.middleware.close();
301295
}
302296

297+
Server.prototype.sockWrite = function(type, data) {
298+
if (this.sock) {
299+
this.sock.write(JSON.stringify({type: type, data: data}));
300+
}
301+
}
302+
303303
Server.prototype.serveMagicHtml = function(req, res, next) {
304304
var _path = req.path;
305305
try {

0 commit comments

Comments
 (0)