Sha256: 0bcdd0affa9d3e506a1ab11b12f892420e6ddf8a5b8b37adba781e373e8cee74
Contents?: true
Size: 954 Bytes
Versions: 2
Compression:
Stored size: 954 Bytes
Contents
#Mercury.websocket = # # websocket: $.websocket("ws://#{$.uri(window.location.href).host}:8081") # # # send: (eventName, options) -> # package = {} # package[eventName] = options # @websocket.send(package) # # # bind: (eventName, callback) -> # # todo: this will override any that are already set -- callbacks should be an array that we can push onto # $.websocketSettings[eventName] = callback #window.socket = $.websocket(, { # lock: (element) -> # $('#' + element).attr('disabled', true); # # unlock: (element) -> # $('#' + element).attr('disabled', false); # # chat: (element) -> # $('#chat').get(0).innerHTML += message + "<br/>"; #}); # #$(document).ready -> # # $('.shared').bind 'focus', -> window.socket.send({"lock": this.id}) # # $('.shared').bind 'blur', -> window.socket.send({"unlock": this.id}) # # $('.shared').bind 'keypress', (e) -> # window.socket.send({chat: $(this).val()}) if (e.charCode == 13)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mercury-rails-0.1.1 | app/assets/javascripts/mercury/websocket.js.coffee |
mercury-rails-0.1.0 | app/assets/javascripts/mercury/websocket.js.coffee |