How can I invoke WCMuse java class from JAVASCRIPT Use api
I have a wcmuse class which works fine with data-sly-use.
Now I want to invoke this class and its methods from Sightly Javascript-use api.
I want to do some extra work hence i need to have data-sly-use functionality in javascript.
Please help.
When I try this code in JS its getting instantiated but the activate method is not invoked :
use(function () {
var articleList = new Packages.com.xxx.cq.unifiedweb.core.sightly.DocumentationPageHelper;
var list = articleList.getRecommendedList();
// you can reference the parameters via the this keyword.
var retValue = this.value1 + this.seperator + this.value2;
return {
newValue: retValue
};
});
Java class :
public class DocumentationPageHelper extends WCMUse {
@Override
public void activate() throws Exception {
SlingScriptHelper slingScriptHelper = getSlingScriptHelper();
/** Do something **/
}
}