Sha256: 143b3d54a5535b0b4aa180b6ddd43e59185704108a8a00520a450bc938497892
Contents?: true
Size: 866 Bytes
Versions: 6
Compression:
Stored size: 866 Bytes
Contents
io.setPath("/javascripts/socket.io/") var socket = new io.Socket('localhost', {port:8081}) function active() { $('#kthxbye').removeClass("failed success").addClass("active") } function failed() { $('#kthxbye').removeClass("active success").addClass("failed") } function succeeded() { $('#kthxbye').removeClass("active failed").addClass("success") } if(socket.connect()) { socket.on('message', function(data) { try { var status = JSON.parse(data) } catch (SyntaxError) { return false; } if(status.id != parseInt(job_id)) return false; if(status.status == 'job.failed') { failed() } else if(status.status == 'job.completed') { succeeded() } else if(status.status == 'job.started') { active() } else { alert('Unknown option! ' + status.status) } return false }) }
Version data entries
6 entries across 6 versions & 1 rubygems