code: function destroy() {
      var element = this.element,
          options = this.options;
  
  
      if (!getData(element, NAMESPACE)) {
        return this;
      }
  
      this.destroyed = true;
  
      if (this.ready) {
        if (this.played) {
          this.stop();
        }
  
        if (options.inline) {
          if (this.fulled) {
            this.exit();
          }
  
          this.unbind();
        } else if (this.isShown) {
          if (this.viewing) {
            if (this.imageRendering) {
              this.imageRendering.abort();
            } else if (this.imageInitializing) {
              this.imageInitializing.abort();
            }
          }
  
          if (this.hiding) {
            this.transitioning.abort();
          }
  
          this.hidden();
        } else if (this.showing) {
          this.transitioning.abort();
          this.hidden();
        }
  
        this.ready = false;
        this.viewer.parentNode.removeChild(this.viewer);
      } else if (options.inline) {
        if (this.delaying) {
          this.delaying.abort();
        } else if (this.initializing) {
          this.initializing.abort();
        }
      }
  
      if (!options.inline) {
        removeListener(element, EVENT_CLICK, this.onStart);
      }
  
      removeData(element, NAMESPACE);
      return this;
    }
docs: Destroy the viewer