Sha256: ffe64ff34b526a85b83123bedde7cf64c262fe72a4f4f785c42d58d085d35d71
Contents?: true
Size: 1.49 KB
Versions: 30
Compression:
Stored size: 1.49 KB
Contents
(function() { Luca.SocketManager = (function() { function SocketManager(options) { this.options = options != null ? options : {}; _.extend(Backbone.Events); this.loadTransport(); } SocketManager.prototype.connect = function() { switch (this.options.provider) { case "socket.io": return this.socket = io.connect(this.options.socket_host); case "faye.js": return this.socket = new Faye.Client(this.options.socket_host); } }; SocketManager.prototype.transportLoaded = function() { return this.connect(); }; SocketManager.prototype.transport_script = function() { switch (this.options.provider) { case "socket.io": return "" + this.options.transport_host + "/socket.io/socket.io.js"; case "faye.js": return "" + this.options.transport_host + "/faye.js"; } }; SocketManager.prototype.loadTransport = function() { var script, _this = this; script = document.createElement('script'); script.setAttribute("type", "text/javascript"); script.setAttribute("src", this.transport_script()); script.onload = this.transportLoaded; if (Luca.util.isIE()) { script.onreadystatechange = function() { if (script.readyState === "loaded") return _this.transportLoaded(); }; } return document.getElementsByTagName('head')[0].appendChild(script); }; return SocketManager; })(); }).call(this);
Version data entries
30 entries across 30 versions & 1 rubygems