(wordStat)
| 11 | this.emitEvent(wordStat); |
| 12 | } |
| 13 | emitEvent(wordStat) { |
| 14 | // create count envent |
| 15 | let countEvent = new CustomEvent("count", { |
| 16 | bubbles: true, |
| 17 | cancelable: true, |
| 18 | detail: { |
| 19 | wordStat, |
| 20 | }, |
| 21 | // dispatch the count event |
| 22 | }); |
| 23 | this.inputText.dispatchEvent(countEvent); |
| 24 | } |
| 25 | //get wordStat() method uses a regular expression |
| 26 | getWordStat(str) { |
| 27 | let matches = str.match(/\S+/g); |