User:Incongruence/OnMessage

So, you're writing a chat plugin are you? Fun stuff. Don't make the same mistake I did and assume there's no simple callback for new messages, because there is. It's just not particularly obvious. Until I found this I was doing daft things like polling the number of li elements in the chat element. This is a lifesaver. Just pass your function into the following code: Easy as that.