How to use the cordova/exec/proxy.add function in cordova

To help you get started, we’ve selected a few cordova examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / cordova-windows / cordova-js-src / exec.js View on Github external
module.exports = function (success, fail, service, action, args) {

    // Handle the case when we have an old version of splashscreen plugin to avoid the API calls failures
    if (service === 'SplashScreen') {
        var pluginsVersions = require('cordova/plugin_list').metadata;
        var splashscreenVersion = pluginsVersions['cordova-plugin-splashscreen'];
        var MIN_SPLASHSCREEN_SUPPORTED_VER = 4;
        if (splashscreenVersion && ((parseInt(splashscreenVersion.split('.')[0], 10) || 0) < MIN_SPLASHSCREEN_SUPPORTED_VER)) {
            console.log('Warning: A more recent version of cordova-plugin-splashscreen has been hooked into for compatibility reasons. Update the plugin to version >= 4.');

            var platformSplashscreen = require('cordova/splashscreen');
            // Replace old plugin proxy with the platform's one
            require('cordova/exec/proxy').add(service, platformSplashscreen);
        }
    }

    var proxy = execProxy.get(service, action);
    var callbackId;
    var onSuccess;
    var onError;

    args = args || [];

    if (proxy) {
        callbackId = service + cordova.callbackId++;
        // console.log("EXEC:" + service + " : " + action);
        if (typeof success === 'function' || typeof fail === 'function') {
            cordova.callbacks[callbackId] = { success: success, fail: fail };
        }
github bunsenbrowser / bunsen / plugins / cordova-plugin-device / src / ubuntu / device.js View on Github external
* under the License.
 *
*/

/* global Cordova */

module.exports = {
    getInfo:function(win,fail,args) {
        Cordova.exec(function (model, cordova, platform, uuid, version) {
            win({name: name, model: model, cordova: cordova,
                 platform: platform, uuid: uuid, version: version});
        }, null, "com.cordova.Device", "getInfo", []);
    }
};

require("cordova/exec/proxy").add("Device", module.exports);
github tutao / tutanota / cordova / plugins / cordova-plugin-statusbar / src / windows / StatusBarProxy.js View on Github external
show: function (win, fail) {
        // added support check so no error thrown, when calling this method
        if (isSupported()) {
            getViewStatusBar().showAsync().done(win, fail);
        }
    },

    hide: function (win, fail) {
        // added support check so no error thrown, when calling this method
        if (isSupported()) {
            getViewStatusBar().hideAsync().done(win, fail);
        }
    }
};
require("cordova/exec/proxy").add("StatusBar", module.exports);
github object-layer / cordova-sqlite-plugin / example / cordova-app / plugins / cordova-sqlite-plugin / example / cordova-app / plugins / org.objectlayer.cordova-sqlite-plugin / src / windows / SQLiteProxy.js View on Github external
//console.log("return results: " + JSON.stringify(results));
			win(results);
		});
	},
	"delete": function(win, fail, args) {
	    var options = args[0];
	    var res;
		try {
		    //res = SQLitePluginRT.SQLitePlugin.deleteAsync(JSON.stringify(options));
		} catch(ex) {
			fail(ex);
		}
		//handle(res, win, fail);
	}
};
require("cordova/exec/proxy").add("SQLitePlugin", module.exports);
github apache / cordova-plugin-battery-status / src / firefoxos / BatteryProxy.js View on Github external
_callBack({level: (mozBattery.level * 100), isPlugged: mozBattery.charging});
        });
    },

    detachListeners: function () {

        mozBattery.removeEventListener('chargingchange', null);
        mozBattery.removeEventListener('levelchange', null);
    },

    updateBatteryStatus: function (_callBack) {
        _callBack({level: (mozBattery.level * 100), isPlugged: mozBattery.charging});
    }
};

require('cordova/exec/proxy').add('Battery', Battery);
github VitaliiBlagodir / cordova-plugin-datepicker / src / windows / DatePickerProxy.js View on Github external
overlay.parentElement.removeChild(overlay);
                success(dateTimeStr);


            });

            leftCell.appendChild(useButton);

            document.body.appendChild(overlay);
            
        }
    }
};

require("cordova/exec/proxy").add("DatePickerPlugin",module.exports);

});
github qualintitative / egoweb / app / plugins / org.apache.cordova.file-transfer / www / firefoxos / FileTransferProxy.js View on Github external
function onSuccess(entry) {
            if (typeof(successCallback) === 'function') {
                successCallback(entry);
            }
        }

        function onFail(error) {
            delete xhr[id];
            if (typeof(errorCallback) === 'function') {
                errorCallback(error);
            }
        }
    }
};

require('cordova/exec/proxy').add('FileTransfer', module.exports);
github apache / cordova-plugin-file / src / windows8 / FileProxy.js View on Github external
getFolderFromPathAsync(path).then(
                    function (storageFolder) {
                        var cordovaPath = nativePathToCordova(storageFolder.path);
                        success(new DirectoryEntry(storageFolder.name, cordovaPath, getFilesystemFromPath(storageFolder.path), cordovaPath));
                    }, function () {
                        fail(FileError.NOT_FOUND_ERR);
                    }
                );
            }
        );
    }


};

require("cordova/exec/proxy").add("File",module.exports);
github Pushwoosh / pushwoosh-phonegap-plugin / src / windows / PushwooshPluginProxy.js View on Github external
for (key in tags[0]) {
            keys.push(key);
            values.push(tags[0][key]);
        }

        this.service.sendTag(keys, values, null, null);
        success();
    },

    setApplicationIconBadgeNumber: function (success, fail, config) {
        var badge = config[0]["badge"];
        this.service.setBadgeNumber(badge);
    }
};

require("cordova/exec/proxy").add("PushNotification", module.exports);