code: function() {
          this.map &&
              this.map.events.unregister("moveend", this, this.updateAttribution);
          OpenLayers.Layer.XYZ.prototype.destroy.apply(this, arguments);
      }
docs: Method: destroy