I have read from multiple blogs, HTL scripting documentation that JavaScript use scripts are compiled on run time and hence they are slower compared to Java use script and sling model. But I do not understand what does runtime here means, would the JavaScript code be compiled to Sling code when it is called by a component? or Would the code be compiled to Sling code once it is installed to the server? Also, if there is a performance overhead in using JavaScript use script over a Sling model, how big is it?
I have also read in so many questions that use scripts should be restricted to components. But I do not see any problems with use scripts processing data from multiple components as we could pass arguments while calling them. Is there any reason people prefer to restrict use scripts just to a specific component?
Solved! Go to Solution.
Views
Replies
Total Likes
hi @aemAmateur ,
Javascript API is mainly brought in to enable Frond end developers to handle server side logics. We can also use all the JAVA APIs like Resource resolver, Externaliser etc in JS API. AEM internally uses RHINO to convert everything to Java and to make it work. Since the conversion happens in the background, the performance is considered as slow compared to JAVA API.
Also there is no debugging facility with JS API unlike JAVA API.
I would suggest to use Sling Models as it the preferred way in most of the cases (current recommendation by adobe for SPA and HTL)
Use js executes at server level. I usually don't prefer to work on it until and unless there is no option.
mostly people use it if there is any enhancement or customization on authoring.
right now everything is possible with sling models.
Views
Replies
Total Likes
hi @aemAmateur ,
Javascript API is mainly brought in to enable Frond end developers to handle server side logics. We can also use all the JAVA APIs like Resource resolver, Externaliser etc in JS API. AEM internally uses RHINO to convert everything to Java and to make it work. Since the conversion happens in the background, the performance is considered as slow compared to JAVA API.
Also there is no debugging facility with JS API unlike JAVA API.
I would suggest to use Sling Models as it the preferred way in most of the cases (current recommendation by adobe for SPA and HTL)
Views
Likes
Replies