tameemsafi / typewriterjs

A simple yet powerful native javascript plugin for a cool typewriter effect.
https://www.npmjs.com/package/typewriter-effect
MIT License
2.43k stars 218 forks source link

Callback runs twice with NextJS? #153

Open vincepolston opened 1 year ago

vincepolston commented 1 year ago

Didn't see this question asked elsewhere. It appears that the callFunction runs twice.

<Typewriter
onInit={(typewriter) => {
    typewriter.typeString("Welcome to Dev Diaries...")
    .pauseFor(1000)
    .deleteAll()
    typewriter.typeString("The podcast for developers and technical founders.")
    .pauseFor(1500)
    .deleteAll()
    typewriter.typeString("Launching January 2023. Join us..")
    .pauseFor(1500)
    .callFunction(() => {

        console.log('finished typewriter text...')

    })
    .start();
}}
/>

The above code results in the console log spitting out the text twice. I've also tried creating a function and calling it within the .callFunction which also results in it being run twice. Thoughts? Thanks in advance. Great library.

HakonHarnes commented 1 year ago

I also have this issue. Did you find a fix?

vincepolston commented 1 year ago

Unfortunately I have not. It's a strange one.