Reputation: 488
Here is what I have, but it's not working:
chrome.manifest = (function() {
var manifestObject = false;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
manifestObject = JSON.parse(xhr.responseText);
}
};
xhr.open("GET", chrome.extension.getURL('../manifest.json'), false);
try {
xhr.send();
} catch(e) {
console.log('Couldn\'t load manifest.json');
}
return manifestObject;
})();
function versionNumber() {
chrome.app.getDetails().version
}
function myVersion2() {
return versionNumber();
}
The value that is returned is undefined
The value that should be returned is the version number of the extension; i.e. 1.0
If you have a better or simpler or easier method, feel free to post it. All I need to to return the version number in function myVersion2()
SOLVED!
Solved, all I had to do was this:
function myVersion2() {
return chrome.app.getDetails().version;
}
I could delete everything else.
Upvotes: 0
Views: 1158
Reputation: 649
I believe the manifest version is held in chrome.app.getDetails().manifest_version
. Is this what you were after?
Upvotes: 3