Sha256: c13205291917e06fa7736c814e03b65430afd2f6178c8326897a2c6461e66c74
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
(function($) { if (!window.WebSocket && !window.MozWebSocket) { alert("This browser does NOT support websockets and thus termvana fail :("); } if(window.WebSocket) var ws = new WebSocket("ws://"+window.location.host+"/socket"); else if(window.MozWebSocket) var ws = new MozWebSocket("ws://"+window.location.host+"/socket"); ws.onmessage = function(e) { var data = e.data; data = JSON.parse(data); if (data.type == ("AUTOCOMPLETE")) { var completions = $.parseJSON(data.replace(/^:AUTOCOMPLETE: /, '')); $.readline.finishCompletion(completions); } else { console.log("Got message of ", data.message, data); $.repl.logResult(data.message); } }; ws.onclose = function() { $.repl.disable(); return $.repl.log("<div class='nirvana_exception'>termvana: websocket closed</div>"); }; ws.onerror = function() { return $.repl.log("<div class='nirvana_exception'>termvana: websocket error</div>"); }; $.ws = function() { return ws }; $.ws.nirvanaComplete = function(val) { ws.send(':AUTOCOMPLETE: '+val); }; })(jQuery);
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
termvana-0.2.0.beta2 | lib/termvana/public/js/nirvana.js |
termvana-0.2.0.beta1 | lib/termvana/public/js/nirvana.js |