Hacker News new | ask | show | jobs
by durkie 824 days ago
So this is kind of tangentially related here, but is there a "state-of-the-art" or best practices on digging through big JS apps / frameworks / objects? Ultimately this is all code running on my machine, so it feels like it should be accessible in the console somewhere.

I've had to do a fair amount of this with a Chrome extension I maintain that hooks in to routing (creating bike / running routes) sites, and fortunately these mostly use React and I'm decently familiar with how to hook in to that.

But is there a limit here? Is there a way to actually keep code from being inaccessible to the console (aside from obfuscation / compiling to wasm)?

3 comments

Not in a way that differs from old-fashioned web scraping. If the website you're targeting is built using a framework and is server-side rendered then it'll most definitely also send all the data it needs for hydrating on the client as JSON, usually attached to the window object as "window.__INITIAL_STATE__" or similar. There are no limits :–)
I'm working in vue, and get lost at the transition between my code and the framework stuff, when an error "falls through the cracks", and the call stack comes from the framework. What do you do for that, even?
Great question. Would love to know more about this from those with experience.