Created
May 28, 2010 18:10
-
-
Save JshWright/417503 to your computer and use it in GitHub Desktop.
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
var client = new APE.Client(); | |
client.load(); | |
client.addEvent('load', function() { | |
posted_by = prompt('Your name?'); | |
client.core.start({"name": posted_by}); | |
$("input[name='posted_by']").val(posted_by); | |
}); | |
client.addEvent('ready', function() { | |
//Once APE is ready, join the messages channel and wait for new messages | |
client.core.join('messages'); | |
client.onRaw('postmsg', function(raw, pipe) { | |
append_message(raw.data); | |
}); | |
}); | |
function append_message(data) { | |
message_str = data.msg + '\nPosted by: <strong>' | |
+ data.posted_by + '</strong> on: ' | |
+ data.timestamp; | |
new_div = $('<div>').addClass('message').html(message_str); | |
$('div#current_messages').append(new_div); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment