Page 1 of 1

Custom cordova plugin "ReferenceError: DHSPluginApperyIO is not defined

Posted: Thu Apr 16, 2015 7:07 am
by ashish thakre

Hi,
I create custom cordova plugin and trying to call that plugin but giving me an Reference error "ReferenceError: DHSPluginApperyIO is not defined .

Cordova_plugin.js
{
"file": "plugins/com.dhs.plugin/www/DHSPlugin.js",
"id": "com.dhs.plugin.DHSPlugin",
"clobbers": [
"DHSPluginApperyIO"
]
}
config.xml

Code: Select all

     param name="android-package" value="com.dhs.plugin.DHSPlugin"  

DHSPlugin.js
cordova.define("com.dhs.plugin.DHSPlugin", function(require, exports, module) {
function DHSPlugin() {
}

DHSPlugin.prototype.fileDownload = function (message successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "DHSPlugin", "fileDownload", message);
};

DHSPlugin.prototype.getFileNameArray = function (message successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, "DHSPlugin", "getFileNameArray", message);
};

DHSPlugin.install = function () {
if (!window.plugins) {
window.plugins = {};
}

window.plugins.dhsplugin = new DHSPlugin();
return window.plugins.dhsplugin;
};

cordova.addConstructor(DHSPlugin.install);

var dhsplugin = new DHSPlugin();

module.exports = dhsplugin;
});

Any help on this will be appreciate

Regards
Ashish


Custom cordova plugin "ReferenceError: DHSPluginApperyIO is not defined

Posted: Thu Apr 16, 2015 7:11 am
by ashish thakre

Waiting for responce


Custom cordova plugin "ReferenceError: DHSPluginApperyIO is not defined

Posted: Thu Apr 16, 2015 7:12 am
by ashish thakre

Calling native function like this

function sucessFileDownload(){
alert('sucess');
}
function errorFileDownloading(){
alert('failed');
}
DHSPluginApperyIO.fileDownload(jsonArray, sucessFileDownload, errorFileDownloading);


Custom cordova plugin "ReferenceError: DHSPluginApperyIO is not defined

Posted: Thu Apr 16, 2015 5:51 pm
by Illya Stepanov

Hi Ashish -

It is hard to say what could be wrong here, since if you've created this plugin it is hard to say how it should be defined.

You can review our section here to better understand how you can integrate Cordova/PhoneGap plugin in Appery.io: https://devcenter.appery.io/documenta...