I have the following code in PhoneGap iPhone, in file Geofence.js
Geofence.prototype.subscribeToLayer = function(layerName,circularRadius,successCallback){
PhoneGap.exec("Geofence.subscribeToLayer",layerName, circularRadius,{
onSuccess:GetFunctionName(successCallback),
});
Here there
Geofence.h
Geofence.m
These are methods in
Geofence class
-(void)subscribeToLayer:(NSArray *)arguments withDict:(NSDictionary *)options;
I want someone to describe these lines of code, I am an iOS Developer, but not strong concepts of jQuery Mobile, and JS.
Thanks in Advance
It’s parts of a PhoneGap plugin implementation.
The first part with
PhoneGap.execdefines a wrapper function to hide the implementation details of the platforms JavaScript PhoneGap “runtime”.The second part is the native iOS side of the plugin.
subscribeToLayer:withDict:is the instance method that will be called when calling the JavaScript function. An instance of theGeofenceclass will be created when starting up PhoneGap.There should also be a key/value pair in the
pluginsdictionary in thePhoneGap.plistfile to inform PhoneGap about the plugin and how to map it to a Objective-C class.But is this code quite old? I think the plugin API looks a bit different in newer versions, at least for iOS.