What about a pre-build hook that parses the config.xml file and generates a config.js file, with a "CorodvaPrefs" or similar object?
Marc On Tue, Aug 5, 2014 at 10:15 PM, Juan Cruz Viotti <[email protected]> wrote: > Hi everyone, > > I’ve stumbled in the situation where I want to read the value of a > preference present in config.xml from the JavaScript side of a Cordova > plugin. > > My current approach is the following: > > - Create a native service (iOS in this case) with a method called > `getPreference` which queries `self.commandDelegate.settings`. > - Wait on the `deviceready` event from the plugin’s JavaScript file. > - Call `getPreference` with `cordova.exec`. > > I’d like to avoid this complexity and overhead and just be able to query > the preferences from the JavaScript side of the plugin, without depending > on the native side. > > I’ve created a StackOverflow question ( > http://stackoverflow.com/questions/24939920/access-config-xml-preferences-from-javascript-plugins) > some time ago (tagged as Cordova) but it was never answered. I’ve also > found a very similar question that wasn’t answered neither: > http://stackoverflow.com/questions/22744269/is-there-a-cordova-plugin-to-read-values-from-config-xml?lq=1 > . > > I’ve looked at Cordova modules such as argscheck, channel, utils, etc in > the GitHub repo (https://github.com/apache/cordova-js) however I couldn’t > find what I’m looking for. > > Can someone point me in the right direction? > > Thanks a lot in advance. > > Regards, > > --- > Juan Cruz Viotti, Software Engineer > [email protected] > > > > > > > >
