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

Clear method? #30

Closed
jesperlandberg opened this issue Jan 1, 2019 · 2 comments
Closed

Clear method? #30

jesperlandberg opened this issue Jan 1, 2019 · 2 comments

Comments

@jesperlandberg
Copy link

Is there any way to clear/reset the typewriter to its initial state? I want to be able to interupt it an restart if from the beginning. Possible?

@tameemsafi
Copy link
Owner

At the moment no but you can use a callback method and delete the element from the DOM and reinitialise the typewriter.

Example: https://jsfiddle.net/8arobk2c/2/

@llibdude
Copy link

Just as a note, i found that this works for my needs:

typewriterRef.current.state.eventQueue = []

In my case I am using the React component and keep a ref to the typewriter object. Setting the eventQueue to empty array does reset the queue. I'm sure there is something wrong with what I'm doing but for now its fine :)

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

3 participants