sockjs/sockjs-client — pull request #76 by substack (2012-06-21 03:02:14+00:00)
Title: now works browserify, considering publishing to npm

These patches detect the presence of `module.exports` and assign accordingly. I saw there was already a shim for AMD define() so I put this patch right next to it.

I also added a check to see if `this === window` in the constructor so that the `new` is optional in front of `SockJS`. Plus I added a `var` in front of the `SockJS = ` so that the SockJS reference won't leak out when the whole module is wrapped in a closure, like browserify does. In the main window context doing `var` assigns onto `window` anyways so this change shouldn't have any impact.

I put some things in the .npmignore that would likely be troublesome in publishing to npm and added a "main" field, so this package should be suitable for an `npm publish`! Just adjust the version field.

When this package hits npm in browserify people will just be able to `require('sockjs-client')` which is much handier