incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse MacFadyen <>
Subject Re: Callback version available in platform natives and JS
Date Thu, 17 Nov 2011 18:05:18 GMT
Runtime js code can look at device.phonegap for the version.

For build-time I like the #define approach, but this can vary by platform.


Sent from my iPhone5

On 2011-11-17, at 9:44 AM, Patrick Mueller <> wrote:

> With the change of the JSON code from PhoneGap 1.1 to 1.2, I had a
> potential issue that could perhaps had been avoided if I knew what version
> of PhoneGap I was using, as a C preproccessor define, in my native code.
> Specifically, I had used the SBJSON include (whatever name that was) in the
> BarcodeScanner plugin.  That code no longer compiled once 1.2 was
> installed.  If I knew the version of PhoneGap, I might have been able to do
> something like:
> #if (expression evaluating whether I'm running 1.2 or greater)
>  #import [[JSONKit include]]
> #else
>  #import [[SBJSON include]]
> #endif
> Likely, I would have had to had similar #ifs in my runtime code, unless
> both libraries have same API.
> Turns out, in this case, my code no longer was using any JSON utility
> methods directly anymore, so deleting the existing SBJSON includes was my
> "fix".
> This just got me thinking that we probably DO want to have the PhoneGap
> version available SOMEHOW for the natives, as well as the JavaScript
> runtime. Having this available in JS would be nice, as we can arrange to do
> a "version check" early to see if people are using different versions of
> .js and native code - a problem I've run into myself.
> Sound right?  If so, I'll open a bug, where we can talk about what the
> "names" and "values" of these version identifiers should be.
> --
> Patrick Mueller

View raw message