Created
April 9, 2012 09:49
-
-
Save liorkesos/2342595 to your computer and use it in GitHub Desktop.
BackTrack.js
This file contains hidden or 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
/* | |
* 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