PageRenderTime 2550ms CodeModel.GetById 2537ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/transports/flashsocket.js

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 54 lines | 38 code | 9 blank | 7 comment | 8 complexity | 6fdd850777d15ebdbb4ab0127d67301e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /**
  2. * Socket.IO client
  3. *
  4. * @author Guillermo Rauch <guillermo@learnboost.com>
  5. * @license The MIT license.
  6. * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
  7. */
  8. (function(){
  9. var io = this.io;
  10. var Flashsocket = io.Transport.flashsocket = function(){
  11. io.Transport.websocket.apply(this, arguments);
  12. };
  13. io.util.inherit(Flashsocket, io.Transport.websocket);
  14. Flashsocket.prototype.type = 'flashsocket';
  15. Flashsocket.prototype.connect = function(){
  16. var self = this, args = arguments;
  17. WebSocket.__addTask(function(){
  18. io.Transport.websocket.prototype.connect.apply(self, args);
  19. });
  20. return this;
  21. };
  22. Flashsocket.prototype.send = function(){
  23. var self = this, args = arguments;
  24. WebSocket.__addTask(function(){
  25. io.Transport.websocket.prototype.send.apply(self, args);
  26. });
  27. return this;
  28. };
  29. Flashsocket.check = function(){
  30. if (typeof WebSocket == 'undefined' || !('__addTask' in WebSocket)) return false;
  31. if (io.util.opera) return false; // opera is buggy with this transport
  32. if ('navigator' in window && 'plugins' in navigator && navigator.plugins['Shockwave Flash']){
  33. return !!navigator.plugins['Shockwave Flash'].description;
  34. }
  35. if ('ActiveXObject' in window) {
  36. try {
  37. return !!new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
  38. } catch (e) {}
  39. }
  40. return false;
  41. };
  42. Flashsocket.xdomainCheck = function(){
  43. return true;
  44. };
  45. })();