// Call this function whenever text is encountered onText = (string s) { // Your code here // The passed parameter s will have been decoded by the time you see // it, and so may contain any character. // // This is a a closure, so code here may reference // variables which are outside of this scope };
Register a handler which will be called whenever text is encountered.