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

Freeze/unfreeze appears to reset the queue? #338

Open
rorosaurus opened this issue Jan 30, 2023 · 1 comment
Open

Freeze/unfreeze appears to reset the queue? #338

rorosaurus opened this issue Jan 30, 2023 · 1 comment

Comments

@rorosaurus
Copy link

I know this looks a little silly, but I'm trying to use the vanilla JS version of TypeIt. At first, this appears to be working correctly, but it ends up repeating test2, never printing test1. Is this the intended behavior? It won't resume where it left off? Or have I made some silly mistake?

The HTML element is created with test1 prepopulated, but I tested this with removing that and settings startDelete to default. I also tested by manually adding the strings with .type and .delete chained methods and got the same result.

I also noticed that freeze() wasn't stopping the cursor animation too. Is that intended behavior? The docs lead me to think no?

let aboutAuthor1TypeIt = 0;
          let aboutAuthor1 = function () {};
          if (aboutAuthor1TypeIt == 0){
            aboutAuthor1 = function () {
                aboutAuthor1TypeIt = new TypeIt("#about-author1", {
                strings: ["test2", "test1"],
                speed: 110,
                loop: true,
                lifeLike: true,
                deleteSpeed: 70,
                startDelete: true,
                cursor: false,
                afterString: async function() {
                  aboutAuthor1TypeIt.freeze();
                  window.setTimeout(aboutAuthor1, 5000);
                }
              }).go();
            }
          } else { aboutAuthor1TypeIt.unfreeze(); }
@rorosaurus
Copy link
Author

I was eventually able to clean this up and get it working, but I think there may still be some bug present. Sometimes it will automatically reprint the original contents of the HTML element, but other times it needs to be manually passed into a .type() command. I'm stumped.

Still can't figure out why the cursor still blinks during freeze, though.

const typeItInstance2 = new TypeIt("#about-author2", {
          speed: 90,
          loop: true,
          lifeLike: true,
          deleteSpeed: 30,
          startDelete: true,
          cursor: false,
          startDelay: 0,
          nextStringDelay: 0,
          afterString: async function() {
            typeItInstance2.freeze();
            window.setTimeout(function () {
              typeItInstance2.unfreeze(); 
            }, 5000);
          }
        })
        .delete(null)
        .type("test2")
        .delete(null)
        .type("test1")
        .go();
        typeItInstance2.freeze();

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

No branches or pull requests

1 participant