Open tmurph opened 3 years ago
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.
I guess a Runtime.executionContextCreated
event must be fired.
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?