UNPKG

@modern-js/runtime-utils

Version:

A Progressive React Framework for modern web development.

19 lines (18 loc) 517 B
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; const getAsyncLocalStorage = () => { if (isBrowser) { console.error("You should not get async storage in browser"); return null; } else { try { const serverStorage = require("./async_storage.server"); return serverStorage.getAsyncLocalStorage(); } catch (err) { console.error("Failed to load server async storage", err); return null; } } }; export { getAsyncLocalStorage };