initial commit
This commit is contained in:
36
node_modules/websocket/lib/browser.js
generated
vendored
Normal file
36
node_modules/websocket/lib/browser.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
var _global = (function() { return this; })();
|
||||
var nativeWebSocket = _global.WebSocket || _global.MozWebSocket;
|
||||
var websocket_version = require('./version');
|
||||
|
||||
|
||||
/**
|
||||
* Expose a W3C WebSocket class with just one or two arguments.
|
||||
*/
|
||||
function W3CWebSocket(uri, protocols) {
|
||||
var native_instance;
|
||||
|
||||
if (protocols) {
|
||||
native_instance = new nativeWebSocket(uri, protocols);
|
||||
}
|
||||
else {
|
||||
native_instance = new nativeWebSocket(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket
|
||||
* class). Since it is an Object it will be returned as it is when creating an
|
||||
* instance of W3CWebSocket via 'new W3CWebSocket()'.
|
||||
*
|
||||
* ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2
|
||||
*/
|
||||
return native_instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
module.exports = {
|
||||
'w3cwebsocket' : nativeWebSocket ? W3CWebSocket : null,
|
||||
'version' : websocket_version
|
||||
};
|
||||
Reference in New Issue
Block a user