I have created a custom (CDVPlugin) Plugin in Cordova app.
Through that plugin if javascript file calls a method which is declared in CDVPlugin then i can easily send response through
CDVPluginResult *pluginResult = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[NSString stringWithFormat:@"%@",deviceUUIDString]];
self.delegateCallbackId=command.callbackId;
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
But how to call a javascript function from my custom CDVPlugin class.
I found the answer if we want to call any javascript method call it with evalJs which is declared in CDVCommandDelegateClass and can write the name of the function as string with semicolon
In Cordova : we can use evaluateJavaScript method like this
[self.commandDelegate evalJs:@"callCustomMethodJs();"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With