basically it is just: start a timer when the first key is pressed, as long the keys are in the time and fit to a combo pattern, record the keys pressed. As soon the timer ran out or the pattern does not fit to any combo anymore, start the timer from 0 and restart the key recording.