MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / createReactStub

Function createReactStub

dashboard/test/hermes-wrapper.test.mjs:10–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8const assetBase = "/dashboard-plugins/tracedecay/dist";
9
10function createReactStub() {
11 return {
12 createElement(type, props, ...children) {
13 return {
14 type,
15 props: { ...(props || {}), children: children.length <= 1 ? children[0] : children },
16 };
17 },
18 useState(initial) {
19 let value = typeof initial === "function" ? initial() : initial;
20 return [
21 value,
22 (next) => {
23 value = typeof next === "function" ? next(value) : next;
24 },
25 ];
26 },
27 useEffect(run) {
28 run();
29 },
30 };
31}
32
33async function loadWrapper({ scriptsByUrl }) {
34 const source = await readFile(wrapperPath, "utf8");

Callers 1

loadWrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected