Is there a tool to install an existing Cordova 3 plugin into a Worklight 6.1 app?
Asked Answered
M

2

8

Worklight 6.1 uses Cordova 3.1. The documentation shows how to author your own Cordova plugin but I can't find any information on how to install existing Cordova 3 style plugins into a Worklight project.

I tried installing the JavaScript and native components, and editing config.xml similar to what I did with Worklight 6.0, and that works in some cases.

But I find that Cordova 3 style plugins are typically authored with the Cordova plugin management utility in mind and can't necessarily be just added to a project as is.

The particular problem I hit was with the use of require() (expecting cordova.require()) in plugin code added to a dojo project. require() was resolving to AMD require() which promptly failed to load "cordova/exec"

When the Cordova plugin management tools are used to add the plugin to a Cordova project, they automatically wrap the plugin's javascript in a cordova.define() function that passes require() (and some other functions) as a parameter. So the standard for Cordova 3 plugins is to use require() without qualification.

I know I can resolve this issue manually each time I use a third party plugin, but was wondering if there were any guides, or tools, or practices around adding existing Cordova 3 style plugins into a Worklight project

Magda answered 8/1, 2014 at 18:10 Comment(4)
With "it can't be done?" I'm still looking for guidance on this question.Magda
Ok. This is not on the radar of the development team right now as far as I know. If you have actual customers who request this, then this will help by opening an RFE, otherwise I don't see it happening any time soon (a tool or a blog post at the least, but you seem to have exeprience with that by now? maybe you should write one. :)Definite
@IdanAdar Is this issue still the same with WL 7.0, I couldn't find any guide about importing existing cordova plugins (in my case cordova-googlemaps-plugin)Disserve
Correct, no change in 7.0.Definite
D
0

Unfortunately at this time there are no guides, practices or tools for what you are asking in Worklight 6.1.0. But perhaps something should be written about it at the very least.

Definite answered 8/1, 2014 at 18:32 Comment(0)
A
-1

In WL6.1 there are steps to create and add application components (see IBM WL6.1 Application Components)
The above docs suggest ways to add additional hooks including Cordova Plugins

Attired answered 4/6, 2014 at 6:2 Comment(1)
Application components is not the same as adding Cordova plug-in.Definite

© 2022 - 2024 — McMap. All rights reserved.