Sha256: cdd4273b1b63595f8734cf23a46077b8a8bc4d1d798e246aafd10108a912d1b7
Contents?: true
Size: 889 Bytes
Versions: 18
Compression:
Stored size: 889 Bytes
Contents
var io = new RocketIO({channel: channel}).connect(); $(function(){ $("#chat #btn_send").click(post); $("#chat #message").keydown(function(e){ if(e.keyCode == 13) post(); }); }); io.on("chat", function(data){ var m = $("<li>").text(data.name + " : " +data.message); $("#chat #timeline").prepend(m); }); io.on("connect", function(){ console.log("connect!! "+io.session); $("#type").text("type : "+io.type); }); io.on("disconnect", function(){ console.log("disconnect!!"); }); io.on("*", function(event, data){ // catch all events console.log(event + " - " + JSON.stringify(data)); }); io.on("error", function(err){ console.error(err); }); 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
18 entries across 11 versions & 1 rubygems