limit keypress rate in js