Skip to content

Instantly share code, notes, and snippets.

@liorkesos
Created April 9, 2012 09:49
Show Gist options
  • Save liorkesos/2342595 to your computer and use it in GitHub Desktop.
Save liorkesos/2342595 to your computer and use it in GitHub Desktop.
BackTrack.js
/*
* This code is adapted from the work of Michael Nachbaur
* by Simon Madine of The Angry Robot Zombie Factory
* 2010-05-04
* MIT licensed
*
* Converted to Cordova by Joseph Stuhr.
*/
/**
* This class exposes the iPhone 'icon badge' functionality to JavaScript
* to add a number (with a red background) to each icon
* @constructor
*/
function BackTrack() {
}
/**
* Positive integer sets the badge, 0 or negative clears it
*/
BackTrack.prototype.start = function(options) {
Cordova.exec("BackTrack.startTrack", options);
};
/**
* Shorthand to set the badge to 0
*/
BackTrack.prototype.stop = function() {
Cordova.exec("BackTrack.stopTrack", 0);
};
Cordova.addConstructor(function() {
if(!window.plugins) {
window.plugins = {};
}
if(!window.plugins.backTrack) {
window.plugins.BackTrack = new BackTrack();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment