Open maks opened 7 years ago
As a starting point I've added Stetho just for network requests and UI structure viewing https://github.com/Jasonette/JASONETTE-Android/pull/133
This question may point the way to adding support to debug the V8 instance supplied by j2v8
Looks like per this article the author of j2v8 uses Stetho to provide Dev tools debugging for their product too. And they too are currently limited to basically just break-point setting because that is all their DebugAPI class provides. I'll try to implement that too, though @gliechtenstein do you think that will be helpful as currently JS is just limited to template expressions? I wonder if this might be a prompt to allow more JS support (JSAction?) rather than relying on the inline JS within expressions?
Sadly it appears that there is no existing support in Stetho for exposing the JS runtime debugging functionality of a JS runtime to Dev Tools via the debug protocol, but the infrastructure is there for it to be added, it would just need work on Stetho itself. I do have an idea on how to approach this from a different angle, so I'll try to build a proof of concept first.
@gliechtenstein As a side note, it appears that PonyDebugger provides similar functionality for iOS, though not quite as nicely out-of-the-box as its needs a gateway server as well.
@maks PonyDebugger looks great! And I like how both stetho and ponydebugger are based on chrome (consistent UX)
I also did some research and found another alternative for iOS https://github.com/Flipboard/FLEX This one looks great and is similar to what you were trying to do for Android. The difference from ponydebugger is that it's an in-app tool instead of using chrome. I guess there are pros and cons for this.
Anyway, after seeing what stetho can do, I think we should package these debugging tools into the core and release them as official features. Maybe even write up some documentation on how to use over at https://github.com/Jasonette/documentation
Would you like to try the documentation for Android stetho part? I'm thinking something similar to what I did here http://docs.jasonette.com/android/ Doesn't have to be super thorough but would be nice to have a step by step walkthrough.
Wow, thanks for the ref to FLEX, thats exactly what I had in mind for a "builder app". But that much bigger long term project then Stetho and Pony so I think its worth doing/having both.
Bit embarrassed by lack of docs I've done for adding Stetho, very happy to do them - I'll get that them done as top priority.
documentation: https://github.com/Jasonette/documentation/pull/65
Decided to incorporate FLEX to iOS dev mode by default. Here's the PR (along with a link to the demo video) https://github.com/Jasonette/JASONETTE-iOS/pull/254.
It's pretty amazing what it can do right out of the box, but I think this can potentially evolve so that users can simply drag stuff around in the screen and it generates JSON WITHOUT even having to use a computer to write JSON.
I'm guessing this is along the lines of what you were envisioning :)
@gliechtenstein Yes thats exactly what I had in mind. In some ways this goes far beyond what can be done with DevTools. Just imagine something like a Flex's UI making changes not in-memory but to the Jasonette JSON "DOM", automatically calling $render to show changes on the fly, plus the changes are text based unlike purely in-memory so can be written out to file, which can be version tracked, "diffs" could be displayed in the UI (eg. transistion back-forwards) not just as plaintext diffs. What I have in mind is not just a "debugging" UI more a "builder UI" which can also be aware of all the actions in the registry along with the options they take so could present that in a nice UI too. The potential here is huge :-)
Currently the debugging ux is pretty bad. Actions with invalid JS in template expressions silently fail, tracing action calls is not possible, seeing the call-stack now that lambdas are available is not possible. Forgetting to
return
a value from a exprssion with multiple js expressions fails silently.Console.log is available for use within expression templates but is very cumbersome to use.
I've had an initial look at j2v8 usage within jasonette but it doesn't seem to expose errors as exceptions thrown into Java. It does appear to have a Debug API available but it does not appear to be documented.