Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'substack/browserify' into dev

  • Loading branch information...
commit 45417a1a3e15a0a212a2553a1db047603950ce0d 2 parents 0279bf9 + a88cf7d
@majek majek authored
Showing with 14 additions and 2 deletions.
  1. +3 −0  .npmignore
  2. +5 −1 lib/index.js
  3. +5 −0 lib/sockjs.js
  4. +1 −1  package.json
View
3  .npmignore
@@ -0,0 +1,3 @@
+.testling_env.sh
+bin/.testling_env.sh
+tests
View
6 lib/index.js
@@ -1,5 +1,5 @@
// Public object
-SockJS = (function(){
+var SockJS = (function(){
var _document = document;
var _window = window;
var utils = {};
@@ -36,3 +36,7 @@ if ('_sockjs_onload' in window) setTimeout(_sockjs_onload, 1);
if (typeof define === 'function' && define.amd) {
define('sockjs', [], function(){return SockJS;});
}
+
+if (typeof module === 'object' && module && module.exports) {
+ module.exports = SockJS;
+}
View
5 lib/sockjs.js
@@ -7,6 +7,11 @@
*/
var SockJS = function(url, dep_protocols_whitelist, options) {
+ if (this === window) {
+ // makes `new` optional
+ return new SockJS(url, dep_protocols_whitelist, options);
+ }
+
var that = this, protocols_whitelist;
that._options = utils.defaultOptions();
if (options) {
View
2  package.json
@@ -14,5 +14,5 @@
"optparse" : "1.0.3",
"node-static" : "0.5.9"
},
- "private": true
+ "main": "sockjs.js"
}
Please sign in to comment.
Something went wrong with that request. Please try again.