Last active
August 29, 2015 13:56
-
-
Save RhinoLance/9059555 to your computer and use it in GitHub Desktop.
Cordova notification wrappers
This file contains 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
if (typeof navigator.notification === 'undefined') { | |
navigator.notification = { | |
confirm: function (message, confirmCallback, title, buttonLabels) { | |
setTimeout(function (){ | |
if (window.confirm(message)) { | |
confirmCallback(1); | |
} | |
else { | |
confirmCallback(2); | |
} | |
}, 0); | |
}, | |
prompt: function (message, callback, title, buttonLabels) { | |
setTimeout(function(){ | |
var result = window.prompt(message, title); | |
callback({ | |
buttonIndex: 1, | |
input1: result | |
}); | |
}, 0); | |
}, | |
alert: function (message, callback, title, buttonName) { | |
setTimeout(function() { | |
alert(message); | |
callback(); | |
}, 0); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment