@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
17 lines • 615 B
JavaScript
import { useContext } from "react";
import { ReportContext } from "../context/index.js";
function useVisibleLayers() {
const context = useContext(ReportContext);
if (!context) {
throw new Error("ReportContext could not be found.");
}
/* Toggles the visibility of a given layer id */
function toggleLayerVisibility(layerId) {
if (context && context.toggleLayerVisibility) {
context.toggleLayerVisibility(layerId);
}
}
return [context.visibleLayers, toggleLayerVisibility];
}
export default useVisibleLayers;
//# sourceMappingURL=useVisibleLayers.js.map