pikaso icon indicating copy to clipboard operation
pikaso copied to clipboard

Add destroy method to Pikaso instance

Open gniuslab opened this issue 1 year ago • 0 comments

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;
      }
    }
  }
}

gniuslab avatar Apr 22 '23 18:04 gniuslab