MCPcopy
hub / github.com/mattboldt/typed.js / doneTyping

Method doneTyping

src/typed.js:249–273  ·  view source on GitHub ↗

* We're done typing the current string * @param {string} curString the current string in the strings array * @param {number} curStrPos the current position in the curString * @private

(curString, curStrPos)

Source from the content-addressed store, hash-verified

247 * @private
248 */
249 doneTyping(curString, curStrPos) {
250 // fires callback function
251 this.options.onStringTyped(this.arrayPos, this);
252 this.toggleBlinking(true);
253 // is this the final string
254 if (this.isFinalString()) {
255 // callback that occurs on the last typed string
256 this.complete();
257 // quit if we wont loop back
258 if (this.loop === false || this.curLoop === this.loopCount) {
259 return;
260 }
261 }
262
263 if (this.shouldBackspace) {
264 this.timeout = setTimeout(() => {
265 this.backspace(curString, curStrPos);
266 }, this.backDelay);
267 } else {
268 this.timeout = setTimeout(() => {
269 this.arrayPos++;
270 this.typewrite(this.strings[this.sequence[this.arrayPos]], 0);
271 }, this.backDelay);
272 }
273 }
274
275 /**
276 * Backspaces 1 character at a time

Callers 1

typewriteMethod · 0.95

Calls 6

toggleBlinkingMethod · 0.95
isFinalStringMethod · 0.95
completeMethod · 0.95
backspaceMethod · 0.95
typewriteMethod · 0.95
onStringTypedMethod · 0.80

Tested by

no test coverage detected