one
Version:
One is a new React Framework that makes Vite serve both native and web.
18 lines (17 loc) • 767 B
JavaScript
import { createContext, useContext, useId } from "react";
var ServerHeadInsertions = {},
getServerHeadInsertions = function (id) {
if (ServerHeadInsertions[id]) return Object.values(ServerHeadInsertions[id]);
},
ServerRenderID = /* @__PURE__ */createContext(""),
useServerHeadInsertion = function (callback) {
if (typeof window > "u") {
var _ServerHeadInsertions,
_id,
insertionID = useId(),
id = useContext(ServerRenderID);
(_ServerHeadInsertions = ServerHeadInsertions)[_id = id] || (_ServerHeadInsertions[_id] = {}), ServerHeadInsertions[id][insertionID] = callback;
}
};
export { ServerRenderID, getServerHeadInsertions, useServerHeadInsertion };
//# sourceMappingURL=useServerHeadInsertion.native.js.map