Created
June 27, 2014 13:03
-
-
Save dereklawless/57f2992511d4c31e5b96 to your computer and use it in GitHub Desktop.
Cordova iOS appversion plugin JavaScript wapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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