src/core/context.js
/**
   * Destroys underling regl and gl context instances and removes
   * underling DOM element from its parent element if it exists.
   * @public
   * @method
   * @emits beforedestroy
   * @emits destroy
   * @return {Context}
   */
Destroys underling regl and gl context instances and removes
underling DOM element from its parent element if it exists.
Destroys underling regl and gl context instances and removes underling DOM element from its parent element if it exists .
destroy() {
    this.emit('beforedestroy')
    if (this._regl && 'function' == typeof this._regl.destroy) {
      this._regl.destroy()
      delete this._regl
    }
    if (this._domElement) {
      if (this._domElement.parentElement) {
        this._domElement.parentElement.removeChild(this._domElement)
      }
      delete this._domElement
    }
    this._hasFocus = false
    this._isDestroyed = true
    this.emit('destroy')
    return this
  }
destroy ( ) { this . emit ( 'beforedestroy' ) if ( this . _regl && 'function' == typeof this . _regl . destroy ) { this . _regl . destroy ( ) delete this . _regl } if ( this . _domElement ) { if ( this . _domElement . parentElement ) { this . _domElement . parentElement . removeChild ( this . _domElement ) } delete this . _domElement } this . _hasFocus = false this . _isDestroyed = true this . emit ( 'destroy' ) return this }
Destroys underling regl and gl context instances and removes
 underling DOM element from its parent element if it exists.
Destroys underling regl and gl context instances and removes underling DOM element from its parent element if it exists .