Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is cordova/argscheck used for?

I am trying to figure out what does cordova/argscheck do. I was not able to find any documentation that describes what is it used for nor how to use it.

I managed to find its git repo however no comments are mentioned in the code. I have also taken a look at a couple of plugins and they seem to use it as follows:

Device.prototype.getInfo = function(successCallback, errorCallback) {
    argscheck.checkArgs('fF', 'Device.getInfo', arguments);
    exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
};

This code has been taken from the Device plugin. Find the git repo here.

like image 667
thedethfox Avatar asked Mar 05 '15 07:03

thedethfox


People also ask

How does Cordova work?

Cordova acts as a container for the app that you write using web technologies. When the app is compiled, your code actually stays intact. The compiler just takes your code and makes it available to the web view for rendering. If you've ever opened an HTML file in a browser, that's basically the same thing.

What is platform centered workflow?

Platform-centered Workflow: This workflow is centered around lower-level shell scripts for a specific platform and is used when a developer is focused on building an application on a single platform and wants to modify it at a lower level like adding native components to the web-based components.

What is Cordova platform?

Cordova provides the ability to save and restore platforms and plugins. This feature allows developers to save and restore their app to a known state without having to check in all of the platform and plugin source code.


1 Answers

I have figured it out is seems that the function is used to check the parameters to make sure that they are one of the following:

'A'=> 'Array'
'D'=> 'Date'
'N'=> 'Number'
'S'=> 'String'
'F'=> 'Function'
'O'=> 'Object'
'*'=>  'Anything goes'

This check is done to make sure that the java calls that will be called using the exec function will not throw any errors because of bad parameter types.

like image 134
thedethfox Avatar answered Oct 05 '22 02:10

thedethfox