Skip to content

Commit bc70bc2

Browse files
James Hallidaymajek
authored andcommitted
make new optional
1 parent 0b6ee5d commit bc70bc2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/sockjs.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
*/
88

99
var SockJS = function(url, dep_protocols_whitelist, options) {
10+
if (this === window) {
11+
// makes `new` optional
12+
return new SockJS(url, dep_protocols_whitelist, options);
13+
}
14+
1015
var that = this, protocols_whitelist;
1116
that._options = {devel: false, debug: false, protocols_whitelist: [],
1217
info: undefined, rtt: undefined};

0 commit comments

Comments
 (0)