I called a callback cb with cb(void) which worked fine in Chrome but on Android and iOS I got an error complaining on “Unexpected token void” so had to switch to cb(null).

Missing error message? Or should i be allowed to call with void also for Android and iOS?

Submitted by Terje Pedersen on 21 June 2011 at 12:02

On 8 July 2011 at 10:29 Zef Hemel commented:

Actually calling cb(void) makes no sense, because that would pass the type void as a value to the cb callback. Usually mobl would give an error for this, except for the fact that a callback takes can take an argument of any type (including types).

Apparently, the Android Javascript parser is more strict and results in a parse error. In general: don’t do this, just pass null :-)


On 8 July 2011 at 10:29 Zef Hemel closed this issue.

On 8 July 2011 at 10:52 Terje Pedersen commented:

I learned that, but it should have reported a warning.

Log in to post comments