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

Cancel option #14

Closed
okvic77 opened this issue Jan 31, 2017 · 4 comments
Closed

Cancel option #14

okvic77 opened this issue Jan 31, 2017 · 4 comments

Comments

@okvic77
Copy link

okvic77 commented Jan 31, 2017

Is there a cancel method?

I'm using react but if a unmount the view the callback onFinished still active and generate some errors with this.setState react method, because the element is not mounted.

Thanks.

@luisvinicius167
Copy link
Owner

@okvic77 Do you have any example?

@okvic77
Copy link
Author

okvic77 commented Feb 1, 2017

componentDidMount(){
     this.cancel = init(dom, {
        strings: [
          "Hi"
        ],
        onFinished: () => {
          this.setState({ showButton: true });
        }
}
componentWillUnmount() {
    this.cancel(); // The Dom is removed from the body, and the onFinished function is going to fail because is not mounted.
}

@qikkeronline
Copy link

I'd also like a way to do this, as I'm using it on form elements and want to destroy ityped on click, a destroy method would be great 👍

@luisvinicius167
Copy link
Owner

@qikkeronline @okvic77 Try v0.0.9! Let me know if help you! Thanks! ;)

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