entry.tsx 684 B

123456789101112131415161718192021222324252627282930
  1. // @refresh reload
  2. import { render } from "solid-js/web"
  3. import { App } from "@/app"
  4. import { Platform, PlatformProvider } from "@/context/platform"
  5. const root = document.getElementById("root")
  6. if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
  7. throw new Error(
  8. "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?",
  9. )
  10. }
  11. const platform: Platform = {
  12. platform: "web",
  13. openLink(url: string) {
  14. window.open(url, "_blank")
  15. },
  16. restart: async () => {
  17. window.location.reload()
  18. },
  19. }
  20. render(
  21. () => (
  22. <PlatformProvider value={platform}>
  23. <App />
  24. </PlatformProvider>
  25. ),
  26. root!,
  27. )