MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / emitEvent

Method emitEvent

assets/js/wordCounter.js:13–24  ·  view source on GitHub ↗
(wordStat)

Source from the content-addressed store, hash-verified

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);

Callers 1

countMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected