Created
May 10, 2011 04:52
-
-
Save davidguttman/963917 to your computer and use it in GitHub Desktop.
TwitterChimes Part 2 - 01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/public/js/script.coffee | |
# Let's create an empty object to store our stuff | |
TC = {} | |
# A method to setup our socket | |
TC.init_socket = -> | |
@socket = new io.Socket "localhost", port: 3010 | |
@socket.on "message", @handle_message | |
@socket.connect() | |
# A method to handle our socket messages | |
TC.handle_message = (message) -> | |
# just to make sure it's still working | |
console.log message | |
# Ready, fire | |
$(document).ready -> | |
TC.init_socket() | |
# Our ajax button from last time | |
$('#track_button').click -> | |
track_words = $('#track_words').val() | |
$.get('/track?q=' + track_words) | |
return false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment