Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backspace should set the setPauseStatus to typewrite=false #472

Closed
jsgoupil opened this issue Feb 25, 2021 · 2 comments · Fixed by rahXephonz/ioofy.github.io#2 or jaspermayone-archive/certstream-server#33

Comments

@jsgoupil
Copy link

Description

I'm trying to start/stop a couple of Typed together. I understand there are a lot involved with the timers, however, I believe there is a bug on the line where the backspace starts but it is paused state.

this.setPauseStatus(curString, curStrPos, true);

The 3rd parameter should be false in the backspace function.

Demo

Obviously this demo could be made better with a backDelay. But I want to show the concept of start/stop not handling it properly. This code will never show the second sentence.

https://jsfiddle.net/wq2v047j/2/

var typed = new Typed('#typed', {
  strings: ['First sentence.', 'Second sentence.'],
  onStringTyped: (arg1, arg2) => {
    console.log('Called');
    typed.stop();

    setTimeout(() => typed.start(), 1000);
  }
});

Steps to Reproduce

  1. Run the script above.

Expected behavior:
The backspace sequence should start after 1000ms after the first sentence has been written.

Actual behavior:
Nothing visually happens. But the onStringTyped is called constantly.

Reproduces how often:
100%

Additional Information

My ugly work around is to reset your internal state before I restart.

setTimeout(() => {
    arg2.pause.typewrite = false;
    typed.start()
}, 1000);
@mattboldt
Copy link
Owner

Thank you for the detailed report! Yup, it looks like this is a bug:

typed.js/src/typed.js

Lines 243 to 247 in 646952b

backspace(curString, curStrPos) {
if (this.pause.status === true) {
this.setPauseStatus(curString, curStrPos, true);
return;
}

The 3rd arg should definitely be false. Working on a fix now!

mattboldt added a commit that referenced this issue Mar 27, 2021
@mattboldt
Copy link
Owner

Fixed and published in v2.0.12!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants