Best practices for debugging javascript

Jan 16, 2012 at 4:28pm

Best practices for debugging javascript

I’m trying to debug some javascript objects — not much support inside Max environment so I’m thinking about using a javascript IDE that supports proper debugging and simulating the inputs/outputs.
Before I go off inventing stuff, I’m wondering what others have done that might be more effective.

Jan 17, 2012 at 4:41pm

Where are the Javascript objects that Max makes available?

I spent hours trying to debug security stuff before I realized that the File object is a Max thing, not a general Javascript object (I’m not a Javascript expert).

Before I go writing my own file handling for debugging, I’d rather use the Max stuff if it’s available.

Jan 19, 2012 at 3:21am

Well, I guess I’m answering my own question in hopes it will be helpful for the next person.

I ended up using a tool called WebStorm (from jetbrains) which is a very nice JavaScript IDE/debugger. It uses firefox or chrome as the execution platform.

What I ended up doing was writing a new JS file, visible only during debugging with WebStorm that implements the File object API as defined by Max. It also has a few other misc. functions to emulate the outlet() and the post() functions used in Max.

With that combination, I was able to completely debug the Max javascript code that was causing me grief.

Jan 19, 2012 at 4:20am

I will take a look at this webstorm thing – thanks for the headsup – but it is quite untrue to say that max has no javascript debugging. The javascript editing window (at the bottom) and the max window report any errors they see in the code – the max window does it on save, the js window does it in realtime. Note that some things, like type conversions, only go bad during executions, so no way the debugger can catch them.

Jan 19, 2012 at 8:12am

I said “not much” support.

I’m not a JavaScript expert (and having now learned enough about it so that I can use it with Max, I wish it had never been invented, it’s horrible) and the problems I was having were due to my not understanding some aspects of how JavaScript works. None of the issues were syntax related.

I needed the ability to single-step through code and examine variables. Turns out I was getting bitten mostly by duck-typing.


Jan 19, 2012 at 6:15pm

ok, how about post?

Jan 19, 2012 at 10:02pm

joshua posted some code for a better display what is inside an object/array.

Apr 11, 2014 at 4:38am

Hi I was wondering how far you got with this. I think it would be really useful for big projects to create a set of dummy classes that at least let you step through your code in a browser. The live LOM could also be recreated.


You must be logged in to reply to this topic.