Sha256: 919f9b61a10ed3fd345eaadde03dc68af653c715007aac23b57c50beaa2171d4
Contents?: true
Size: 521 Bytes
Versions: 1
Compression:
Stored size: 521 Bytes
Contents
var io = new CometIO().connect(); io.on("chat", function(data){ var m = $("<li>").text(data.name + " : " +data.message); $("#chat #timeline").prepend(m); }); $(function(){ $("#chat #btn_send").click(post); $("#chat #message").keydown(function(e){ if(e.keyCode == 13) post(); }); }); var post = function(){ var name = $("#chat #name").val(); var message = $("#chat #message").val(); if(message.length < 1) return; io.push("chat", {name: name, message: message}); $("#chat #message").val(""); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-cometio-0.0.1 | sample/public/js/index.js |