What's the purpose of the "merges" and "runs" tags in a Cordova plugin?

johnborges

I've seen these tags used in a couple plugins from apache, but it isn't documented anywhere on what the functionality is. Here's an example taken from the Cordova File Plugin plugin.xml:

<js-module src="www/fileSystemPaths.js" name="fileSystemPaths">
    <merges target="cordova" />
    <runs/>
</js-module>
e666

This is documented in Cordova docs.

Merges is to merge JS namespace of plugin with the one existing in Cordova.

Example :

If a cordova.screenshot exists, and have the method cordova.screenshot.takePicture. If the plugin has a cordova.screenshot.takeVideo it will be added there instead of making unavailable takePicture.

Cordova docs :

Allowed within js-module element. Used to specify the namespace under window object where module.exports gets merged with any existing value. If any key already exists, the module's version overrides the original.

Runs is to don't make the plugin available on window object.

Cordova docs :

Allowed within js-module element. It implies that your code should be specified with cordova.require, but not installed on the window object. This is useful when initializing the module, attaching event handlers or otherwise.

Here is Cordova docs link

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related