diff --git a/static/js/collab_client.js b/static/js/collab_client.js index b697d485..ec575fe0 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -20,11 +20,6 @@ * limitations under the License. */ -$(window).bind("load", function() -{ - getCollabClient.windowLoaded = true; -}); - var chat = require('/chat').chat; // Dependency fill on init. This exists for `pad.socket` only. @@ -268,19 +263,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) }*/ } - function setUpSocketWhenWindowLoaded() - { - if (getCollabClient.windowLoaded) - { - setUpSocket(); - } - else - { - setTimeout(setUpSocketWhenWindowLoaded, 200); - } - } - setTimeout(setUpSocketWhenWindowLoaded, 0); - var hiccupCount = 0; function handleCometHiccup(params) @@ -654,8 +636,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) }, 0); } - var self; - return (self = { + var self = { setOnUserJoin: function(cb) { callbacks.onUserJoin = cb; @@ -698,7 +679,10 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) callWhenNotCommitting: callWhenNotCommitting, addHistoricalAuthors: tellAceAboutHistoricalAuthors, setChannelState: setChannelState - }); + }; + + $(document).ready(setUpSocket); + return self; } function selectElementContents(elem)