You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For context, I'm new to Node and I'm learning by making a simple repl-style app, using Node's repl library. It's just a repl with one predefined variable. Here's the entire app.js:
When I start the app (with --inspect) and connect through Chrome DevTools, the devtools console knows about the repl context variable. I can evaluate hello and see "Hello World!" come back.
When I indium-launch the app, the JS REPL buffer doesn't know about the repl context variable. When I evaluate hello I get a reference error.
I can roughly follow indium's execution path, so I can see why this is happening (evaluation happens in the node server's global context, not in the app's repl context). I just can't figure out if there's a way to tweak the JS REPL setup so that it better emulates Chrome's console behavior.
Has anybody got this working?
The text was updated successfully, but these errors were encountered:
tmurph
changed the title
Can I better emulate Chrome DevTools console through the JS REPL buffer?
Can I emulate Chrome DevTools console through the JS REPL buffer?
Feb 19, 2021
tmurph
changed the title
Can I emulate Chrome DevTools console through the JS REPL buffer?
Can I emulate Chrome DevTools console with the JS REPL buffer?
Feb 19, 2021
I never tried to do anything like that. I'm wondering how this actually works, have you tried inspecting the Chrome devtools to see how the console handles the context?
CDP's Runtime.evaluate can take an optional contextId parameter, but I'm wondering how would Indium know about the context id.
For context, I'm new to Node and I'm learning by making a simple repl-style app, using Node's repl library. It's just a repl with one predefined variable. Here's the entire app.js:
When I start the app (with
--inspect
) and connect through Chrome DevTools, the devtools console knows about the repl context variable. I can evaluatehello
and see "Hello World!" come back.When I
indium-launch
the app, the JS REPL buffer doesn't know about the repl context variable. When I evaluatehello
I get a reference error.I can roughly follow indium's execution path, so I can see why this is happening (evaluation happens in the node server's global context, not in the app's repl context). I just can't figure out if there's a way to tweak the JS REPL setup so that it better emulates Chrome's console behavior.
Has anybody got this working?
The text was updated successfully, but these errors were encountered: