Skip to content
Browse files

make `new` optional

  • Loading branch information...
1 parent 7f9ef4b commit df3847d11a8abd3e963e711eee29c44f17355431 @substack committed Jun 20, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/sockjs.js
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 = {devel: false, debug: false, protocols_whitelist: [],
info: undefined, rtt: undefined};

0 comments on commit df3847d

Please sign in to comment.
Something went wrong with that request. Please try again.