MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / getCurrentInput

Function getCurrentInput

frontend/src/ts/test/events/data.ts:204–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202}
203
204export function getCurrentInput(): string {
205 const last = inputEvents[inputEvents.length - 1];
206
207 if (last !== undefined) {
208 const lastWordIndex = last.data.wordIndex;
209 //just advanced to a new word - no input event for it yet
210 if (lastWordIndex + 1 === activeWordIndex) return "";
211 //last event is for the active word - return its snapshot
212 if (
213 lastWordIndex === activeWordIndex &&
214 last.data.inputValue !== undefined
215 ) {
216 return last.data.inputValue;
217 }
218 }
219
220 return getInputFromDom(getEventsForWord(getAllTestEvents(), activeWordIndex));
221}
222
223export function getInputForWord(wordIndex: number): string {
224 return getInputFromDom(

Callers 15

scrollTapeFunction · 0.90
buildWordLettersHTMLFunction · 0.90
afterAnyTestInputFunction · 0.90
afterTestTextInputFunction · 0.90
afterTestDeleteFunction · 0.90
beforeTestWordChangeFunction · 0.90
test-ui.tsFile · 0.90
updatePositionFunction · 0.90
layoutfluidFunction · 0.90
readAheadHandleKeydownFunction · 0.90
handleSpaceFunction · 0.90

Calls 3

getInputFromDomFunction · 0.90
getEventsForWordFunction · 0.90
getAllTestEventsFunction · 0.85

Tested by

no test coverage detected