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

Add destroy method to Pikaso instance #96

Open
gniuslab opened this issue Apr 22, 2023 · 0 comments
Open

Add destroy method to Pikaso instance #96

gniuslab opened this issue Apr 22, 2023 · 0 comments
Assignees

Comments

@gniuslab
Copy link

Is your feature request related to a problem? Please describe.
Need a way to destroy the Pikaso instance so that it no longer listens for events or any adjacent code

Describe the solution you'd like
In the main instance add a method called destroy similar to the one in KonvaJS

class Pikaso {
  constructor(config) {
    // constructor implementation
  }

  // other methods implementation

  destroy() {
    // stop listening to events
    this.off();

    // other cleanup operations
    // ...

    // set instance properties to null to aid garbage collection
    for (let prop in this) {
      if (this.hasOwnProperty(prop)) {
        this[prop] = null;
      }
    }
  }
}
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

2 participants