MCPcopy Index your code
hub / github.com/Sandpack/nodebox-runtime / foo

Function foo

tests/examples/console.example.js:10–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8 */
9window.runExample = async function (emulatorUrl) {
10 const foo = async () => {
11 const { Nodebox } = window;
12
13 const emulator = new Nodebox({
14 runtimeUrl: emulatorUrl,
15 iframe: document.getElementById('frame'),
16 });
17
18 await emulator.connect();
19 await emulator.fs.init({
20 'index.mjs': `console.group("a", "b");
21 console.log("test");
22 console.group("bla");
23 console.warn("tada");
24 console.groupEnd();
25 console.error("woops");
26 console.groupEnd();
27 console.table({a: "b", nested: {aa: "bbb"}});
28 console.table(["aaa", "bbb"]);
29 console.table(["aaa", "bbb"], []);
30 console.table({a: "b", nested: {aa: "bbb", bb: "aaa"}}, ["aa"]);`,
31 });
32
33 const shellProcess = emulator.shell.create();
34 shellProcess.stdout.on('data', (data) => {
35 console.log(data);
36 });
37 shellProcess.stderr.on('data', (data) => {
38 console.error(data);
39 });
40 await shellProcess.runCommand('node', ['index.mjs']);
41 };
42
43 foo();
44};

Callers 1

console.example.jsFile · 0.70

Calls 5

connectMethod · 0.95
initMethod · 0.80
createMethod · 0.80
runCommandMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected