Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #171 from geraldo/patch-1
Browse files Browse the repository at this point in the history
Update examples/mozillaball/index.html to new API
  • Loading branch information
ianb committed Sep 26, 2012
2 parents 0c6856f + 10e3211 commit f0d9654
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions examples/mozillaball/index.html
Expand Up @@ -98,28 +98,30 @@
var gManifestName = "/manifest.webapp";

$(document).ready(function() {
navigator.apps.amInstalled(function(result) {
if (!result) {
$("#install_button").show();
var request = navigator.mozApps.getSelf();
request.onsuccess = function() {
if (request.result) {
// we're installed
$("#install_button").text("INSTALLED!").show();
} else {
// not installed
$("#install_button").show();
$("#install_button").click(function() {
navigator.apps.install({
url: gManifestName,
onsuccess: function() {
var req = navigator.mozApps.install(gManifestName);
req.onsuccess = function() {
$("#install_button").text("INSTALLED!").unbind('click');
},
onerror: function(errObj) {
}
req.onerror = function(errObj) {
alert("Couldn't install (" + errObj.code + ") " + errObj.message);
}
});
}
});
} else {
$("#install_button").text("INSTALLED!").show();

}
});

}
}
request.onerror = function() {
alert('Error checking installation status: ' + this.error.message);
}
});

</script>

</html>
</html>

0 comments on commit f0d9654

Please sign in to comment.