Permalink
Browse files

Compatibility for Phonegap 2.0

  • Loading branch information...
1 parent 948db0e commit ddd09ea67685725abb4fd940c28ea11cf3869a5f @Patrick64 Patrick64 committed Aug 4, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 Android/WebIntent/webintent.js
@@ -1,5 +1,5 @@
/**
- * Phonegap Web Intent plugin
+ * cordova Web Intent plugin
* Copyright (c) Boris Smus 2010
*
*/
@@ -15,31 +15,31 @@ WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM";
WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL";
WebIntent.prototype.startActivity = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'startActivity', [params]);
};
WebIntent.prototype.hasExtra = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'hasExtra', [params]);
};
WebIntent.prototype.getUri = function(success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'getUri', []);
};
WebIntent.prototype.getExtra = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
@@ -48,20 +48,24 @@ WebIntent.prototype.getExtra = function(params, success, fail) {
WebIntent.prototype.onNewIntent = function(callback) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
callback(args);
}, function(args) {
}, 'WebIntent', 'onNewIntent', []);
};
WebIntent.prototype.sendBroadcast = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'sendBroadcast', [params]);
};
-PhoneGap.addConstructor(function() {
- PhoneGap.addPlugin('webintent', new WebIntent());
+cordova.addConstructor(function() {
+ window.webintent = new WebIntent();
+
+ // backwards compatibility
+ window.plugins = window.plugins || {};
+ window.plugins.webintent = window.webintent;
});

0 comments on commit ddd09ea

Please sign in to comment.