iceddev / node-chromify

Entry point to use node in chrome
http://blog.iceddev.com/2012/11/05/node-js-in-chrome/
Apache License 2.0
170 stars 23 forks source link

The known issue from the blog? #2

Open PlNG opened 12 years ago

PlNG commented 12 years ago

This segment of code looks slightly different from the rest of the comparisons to "undefined" throughout the code. Is it missing a typeof operator? It's been pretty-printed / cleaned by me, but you should get the general idea to look at net.Socket.prototype.setKeepAlive

net.Socket.prototype.setKeepAlive = function (enable, delay) {
    enable = enable === "undefined" ? false : enable;
    delay = delay === "undefined" ? 0 : delay;
    chrome.socket.setKeepAlive(self._socketInfo.socketId, enable, initialDelay, function () {});
};

Saw the project from a Reddit link in /r/JavaScript

525c1e21-bd67-4735-ac99-b4b0e5262290 commented 12 years ago

If the aim is to comply with http://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay ...

Then yes, this code is incorrect.