Download web/src/components/openui/openui-disable-devtools.ts from zlcy/abc: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/spaces/zlcy/abc/resolve/main/web/src/components/openui/openui-disable-devtools.ts
- Command line
-
hf download hf://spaces/zlcy/abc/web/src/components/openui/openui-disable-devtools.ts
-
curl -L -o openui-disable-devtools.ts https://huggingface.co/spaces/zlcy/abc/resolve/main/web/src/components/openui/openui-disable-devtools.ts
763 Bytes
| // 关掉 @openuidev/react-lang 在开发环境下自动挂载的「OpenUI Inspect」浮动按钮 | |
| // (右下角那个图标)。它的自挂载逻辑在 react-lang 模块求值时跑: | |
| // if (!globalThis[Symbol.for("openui.devtools.autoMount")]) { ...挂载... } | |
| // 因此本文件必须作为 import @openuidev/* 之前的【第一个】 import 被求值, | |
| // 才能赶在 react-lang 求值前把开关置为 true。本文件被 openui-renderer-inner.tsx | |
| // 第一个 import,且 react-lang 仅在渲染生成式 UI 时才被动态加载,所以不会泄漏到其它页面。 | |
| if (typeof globalThis !== "undefined") { | |
| try { | |
| (globalThis as Record<symbol, unknown>)[Symbol.for("openui.devtools.autoMount")] = true; | |
| } catch { | |
| /* ignore */ | |
| } | |
| } | |