Files
phonegap-plugins/iPhone/ShareKitPlugin/ShareKitPlugin.js
Matthew Lanham 375c5b69d8 Improvements
- Now uses documented way to target specific services
- Added shareToMail and shareToTwitter
2011-10-30 19:35:21 +00:00

92 lines
1.7 KiB
JavaScript

//
// ShareKitPlugin.js
//
//
// Created by Erick Camacho on 28/07/11.
// MIT Licensed
//
function ShareKitPlugin()
{
console.log('creating plugin');
};
ShareKitPlugin.prototype.share = function(message, url)
{
PhoneGap.exec(null, null, "ShareKitPlugin", "share", [message, url]);
};
ShareKitPlugin.prototype.isLoggedToTwitter = function( callback )
{
PhoneGap.exec(callback, null, "ShareKitPlugin", "isLoggedToTwitter", [] );
};
ShareKitPlugin.prototype.isLoggedToFacebook = function( callback )
{
PhoneGap.exec(callback, null, "ShareKitPlugin", "isLoggedToFacebook", [] );
};
ShareKitPlugin.prototype.logoutFromTwitter = function()
{
PhoneGap.exec(null, null, "ShareKitPlugin", "logoutFromTwitter", [] );
};
ShareKitPlugin.prototype.logoutFromFacebook = function()
{
PhoneGap.exec(null, null, "ShareKitPlugin", "logoutFromFacebook", [] );
};
ShareKitPlugin.prototype.facebookConnect = function()
{
PhoneGap.exec(null, null, "ShareKitPlugin", "facebookConnect", [] );
};
ShareKitPlugin.prototype.shareToFacebook = function( message, url)
{
PhoneGap.exec(null, null, "ShareKitPlugin", "shareToFacebook", [message, url] );
};
ShareKitPlugin.prototype.shareToTwitter = function( message, url)
{
PhoneGap.exec(null, null, "ShareKitPlugin", "shareToTwitter", [message, url] );
};
ShareKitPlugin.prototype.shareToMail = function( subject, message)
{
PhoneGap.exec(null, null, "ShareKitPlugin", "shareToMail", [subject, message] );
};
ShareKitPlugin.install = function()
{
if(!window.plugins)
{
window.plugins = {};
}
window.plugins.shareKit = new ShareKitPlugin();
return window.plugins.shareKit;
};
PhoneGap.addConstructor(ShareKitPlugin.install);