@h4wldev/react-naver-maps
Version:
React Navermaps API integration for modern development.
33 lines (31 loc) • 821 B
JavaScript
import {
loadNavermapsScript
} from "./chunk-HSCTNOCJ.mjs";
import {
useClientOptions
} from "./chunk-4CM6CARW.mjs";
// src/use-navermaps.ts
import { suspend } from "suspend-react";
async function load(options) {
if (typeof window !== "undefined" && window.naver?.maps) {
return window.naver.maps;
}
if (!options) {
throw new Error("react-naver-maps: set options with `useNavermaps.config`");
}
return await loadNavermapsScript(options);
}
function useNavermaps() {
if (typeof window === "undefined") {
throw new Error("react-naver-maps: browser");
}
if (window.naver?.maps) {
return window.naver.maps;
}
const options = useClientOptions();
return suspend(load, [options, "react-naver-maps/loadClient"]);
}
export {
useNavermaps
};
//# sourceMappingURL=chunk-VVUNPVHD.mjs.map