MCPcopy Index your code
hub / github.com/TechSpiritSS/Terminal-Portfolio / createText

Function createText

scripts/functions.js:399–424  ·  view source on GitHub ↗
(text, typingOn = true)

Source from the content-addressed store, hash-verified

397}
398
399async function createText(text, typingOn = true) {
400 const p = document.createElement("p");
401 app.appendChild(p);
402 p.scrollIntoView({ behavior: 'smooth' });
403
404 const typing = localStorage.getItem("typing");
405
406 if (!typingOn || (typing && typing === "off")) {
407 p.innerHTML = text;
408 return;
409 }
410
411 const typingSpeed = localStorage.getItem("typingSpeed") || 20;
412
413 let index = 0;
414 async function writeText() {
415 while (index < text.length) {
416 p.innerHTML += text[index++];
417 await new Promise((writeText) => setTimeout(writeText, typingSpeed));
418 }
419 return;
420 }
421
422 await writeText();
423
424}
425
426async function createCode(code, text, typingOn = true) {
427 const p = document.createElement("p");

Callers 7

openTerminalFunction · 0.90
commandHistoryFunction · 0.90
runSpecificHistoryCmdFunction · 0.90
clearHistoryFunction · 0.90
getInputValueFunction · 0.85
calcFunction · 0.85
typingCmdFunction · 0.85

Calls 1

writeTextFunction · 0.85

Tested by

no test coverage detected