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

How can I ensure that there is only one instance of Seriously #76

Open
mallendeo opened this issue Nov 12, 2014 · 2 comments
Open

How can I ensure that there is only one instance of Seriously #76

mallendeo opened this issue Nov 12, 2014 · 2 comments
Labels

Comments

@mallendeo
Copy link

Hi, I've a problem, there is a button on my app that will create a new instance of Seriously in a canvas, then save some images and destroy the seriously object with seriously.destroy()

I'm calling seriously without new but it keeps throwing this warning Target already use by another instance

What can I do for ensure that there is only one instance?

Thanks!

@positlabs
Copy link

Why don't you just cache the reference to the seriously instance (maybe even the target canvas), and not destroy it? You can update the nodes to reflect the new inputs.

@darkyen
Copy link

darkyen commented Feb 10, 2015

@mallendeo how about

var seriously = null;

button.onClick = function(){
   if( seriously === null ){
       seriously = new Seriously();
   }
   /* do cool stuff with seriously */
}

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

No branches or pull requests

4 participants