src/ol/source/Raster.js
function createLayer(layerOrSource) {
  // @type {import("../layer/Layer.js").default}
  let layer;
  if (layerOrSource instanceof Source) {
    if (layerOrSource instanceof TileSource) {
      layer = new TileLayer({source: layerOrSource});
    } else if (layerOrSource instanceof ImageSource) {
      layer = new ImageLayer({source: layerOrSource});
    }
  } else {
    layer = layerOrSource;
  }
  return layer;
}
function createLayer(layerOrSource) {
  // @type {import("../layer/Layer.js").default}
  let layer;
  if (layerOrSource instanceof Source) {
    if (layerOrSource instanceof TileSource) {
      layer = new TileLayer({source: layerOrSource});
    } else if (layerOrSource instanceof ImageSource) {
      layer = new ImageLayer({source: layerOrSource});
    }
  } else {
    layer = layerOrSource;
  }
  return layer;
}
function createLayer ( layerOrSource ) { // @type {import("../layer/Layer.js").default} let layer ; if ( layerOrSource instanceof Source ) { if ( layerOrSource instanceof TileSource ) { layer = new TileLayer ( { source : layerOrSource } ) ; } else if ( layerOrSource instanceof ImageSource ) { layer = new ImageLayer ( { source : layerOrSource } ) ; } } else { layer = layerOrSource ; } return layer ; }
Create a layer for the provided source.
@param {import("./Source.js").default|import("../layer/Layer.js").default} layerOrSource The layer or source.
@return {import("../layer/Layer.js").default} The layer.
Create a layer for the provided source .