Posts Tagged ‘developer’

Few Notes on Mobile Javacript

Thursday, June 18th, 2009

I’ve been working on a Javascript exercise – well, developing JS library for other users – and finding out that I’m not so good at it. But the only way to become better is to make mistakes. There has been some discussion around mobile devices and Javascript cababilities, performance and other aspects like the famous UX — but the still the documentation could be in better shape.

What I felt nasty is lack of developer tools here. Of course I had both Firebug and Safari 4 developer tools available and they do a good job on desktop. And thus, the code worked fine on the desktop, then I tested it on N97 – still working. But on S60 3.1 – namely N95 and E90, it just crashed. If a read the document right, the Javascript core of these browsers is from early 2007, so in the age of Internet they are rather old.

Thus, I got a bit lost there and started the usual debugging strategies: removing and lines until it started to work. Firstly, I found out that the parser is rather strict on old Nokia devices – my objects had a last comma

o = {

a = ‘a’,

b = ‘b’,

}

which is invalid and thus makes the whole object invalid. So, no comma in the end. The problem for me was, that on desktop browsers it works even with that comma, which makes finding bugs a bit harder. A nice tool here is JSLint, which allows you to check the syntax validity of Javascript code. Otherwise, it’s like hide and seek.