* 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)
| 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 |
no test coverage detected