MCPcopy Create free account
hub / github.com/AyushSaini00/60minuteJavaScript / startReader

Function startReader

Speed-Reader/app.js:19–43  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

17
18//Start the Reader
19function startReader(event){
20 //only run on #start button
21 if(event.target.id !== 'start')
22 return;
23
24 // If there's no text to read, do nothing
25 if (!textElem.value.length)
26 return;
27
28 //store the words in words array
29 words =
30 textElem.value.split(' ') //divide the space separated words into words array
31 .filter(function(individualWord){ //filters empty array elements
32 return individualWord.length;
33 });
34
35 //get the words per minute
36 speed = (60 / parseInt(wpmElem.value, 10)) * 1000; //speed of a word in milliseconds
37
38 //set the current item to the first word
39 current = 0;
40
41 //Run the reader
42 run();
43}
44
45//Stop the Reader
46function stopReader(event){

Callers 1

clickHandlerFunction · 0.85

Calls 1

runFunction · 0.85

Tested by

no test coverage detected