code: function(opacity) {
  
      if (isNaN(opacity) || opacity>1 || opacity<0) {
        throw new Error(opacity + ' is not a valid value');
      }
  
      // Leaflet only accepts 0-0.99... Weird!
      this.options.opacity = Math.min(opacity, 0.99);
  
      if (this.options.visible) {
        L.TileLayer.prototype.setOpacity.call(this, this.options.opacity);
        this.fire('updated');
      }
    }
docs: Change opacity of the layer
  @params {Integer} New opacity