Skip to content

Instantly share code, notes, and snippets.

@dereklawless
Created June 27, 2014 13:03
Show Gist options
  • Save dereklawless/57f2992511d4c31e5b96 to your computer and use it in GitHub Desktop.
Save dereklawless/57f2992511d4c31e5b96 to your computer and use it in GitHub Desktop.
Cordova iOS appversion plugin JavaScript wapper
define(function (require, cordova, undefined) {
'use strict';
/**
* @private
*/
var settings = require('settings');
return {
/**
* Gets the application version.
* @param {requestCallback} callback - The callback handler passed the application version details.
*/
getVersion: function (callback) {
if (cordova && window.AppVersion) {
window.AppVersion.getVersion(function (version) {
var appversion = version;
console.log('Retrieving app version (CFBundleShortVersionString): ' + version);
if (callback && typeof(callback) === 'function') {
callback.apply(this, arguments);
}
});
} else {
console.log('Retrieving app version (settings): ' + settings.client.applicationVersion);
if (callback && typeof(callback) === 'function') {
callback.call(settings.client.applicationVersion);
}
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment