Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save willhoney7/867587 to your computer and use it in GitHub Desktop.
Save willhoney7/867587 to your computer and use it in GitHub Desktop.
function callSpaz(serviceParams, onFailure) {
var appids = ['com.funkatron.app.spaz-sped', 'com.funkatron.app.spaz', 'com.funkatron.app.spaz-beta'], index = 0;
function makeCall() {
if (index < appids.length) {
Mojo.Log.info('Trying to post with appid %s', appids[index]);
var request = new Mojo.Service.Request("palm://com.palm.applicationManager", {
method: 'launch',
parameters: {
id: appids[index],
params: serviceParams
},
onFailure: function() {
Mojo.Log.info('Failed to post with appid %s', appids[index]);
index++; // go to next appid
makeCall(); // retry
}.bind(this)
});
} else {
Mojo.Log.error('Failed to post to Spaz');
if (onFailure) {
onFailure(serviceParams);
}
}
}
makeCall();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment