Files
phonegap-plugins/iOS/SMSComposer/SMSComposer.js
skilesare 7a8049ab5f Update iOS/SMSComposer/SMSComposer.js
Fixed other Capitol C
2013-02-21 22:56:09 -06:00

52 lines
914 B
JavaScript

/**
* SMS Composer plugin for Cordova
* window.plugins.SMSComposer
*
* @constructor
*/
function SMSComposer()
{
this.resultCallback = null;
}
SMSComposer.ComposeResultType =
{
Cancelled:0,
Sent:1,
Failed:2,
NotSent:3
}
SMSComposer.prototype.showSMSComposer = function(toRecipients, body)
{
var args = {};
if(toRecipients)
args.toRecipients = toRecipients;
if(body)
args.body = body;
cordova.exec("SMSComposer.showSMSComposer",args);
}
SMSComposer.prototype.showSMSComposerWithCB = function(cbFunction,toRecipients,body)
{
this.resultCallback = cbFunction;
this.showSMSComposer.apply(this,[toRecipients,body]);
}
SMSComposer.prototype._didFinishWithResult = function(res)
{
this.resultCallback(res);
}
cordova.addConstructor(function() {
if(!window.plugins) {
window.plugins = {};
}
window.plugins.smsComposer = new SMSComposer();
});