basic code for typing event