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