Sightly and Javascript Use-API - where do I find javascript code documentation? | Community
Skip to main content
New Participant
October 16, 2015
Solved

Sightly and Javascript Use-API - where do I find javascript code documentation?

  • October 16, 2015
  • 4 replies
  • 3544 views

Hi,

I can follow the code examples and reference web pages for guidance on how to write javascript to back Sightly html.  However, I am not clear on where the code documentation is to reference when authoring such javascript.  Are there server-side javascript documents akin to the Sightly javadocs?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Here are the Sightly docs:

http://docs.adobe.com/content/docs/en/aem/6-0/develop/sightly.html

https://docs.adobe.com/docs/en/aem/6-0/develop/sightly/use-api-in-java.html

Here is a community article that you can follow to build a Sightly component for AEM: 

Creating your first Adobe Experience Manager Sightly component

In this article - there is a Java part of the Sightly comment. It uses com.adobe.cq.sightly.WCMUse. This is documented here:

https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/cq/sightly/WCMUse.html

4 replies

smacdonald2008
smacdonald2008Accepted solution
New Participant
October 16, 2015

Here are the Sightly docs:

http://docs.adobe.com/content/docs/en/aem/6-0/develop/sightly.html

https://docs.adobe.com/docs/en/aem/6-0/develop/sightly/use-api-in-java.html

Here is a community article that you can follow to build a Sightly component for AEM: 

Creating your first Adobe Experience Manager Sightly component

In this article - there is a Java part of the Sightly comment. It uses com.adobe.cq.sightly.WCMUse. This is documented here:

https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/cq/sightly/WCMUse.html

New Participant
October 16, 2015

Many thanks both for the replies.  I've found, read and used all the pages linked to above.

My question arises from the following development scenario:

  • I am authoring some javascript 'backing' a Sightly html file. 
  • I want to work with properties of the current node (in javascript) as well as its ancestor and child nodes, so I refer to the global objects list and choose currentNode
  • By reading code examples, it looks like currentNode is available to my javascript as a member of  'granite.'.
  • But what javascript functions (methods) are available to me on granite.currentNode?  Can I read code documentation somewhere without having to go directly to whichever javascript file is referenced by the 'granite' object variable?  Or without having to print out the javascript properties of objects like granite.currentNode?

I wondered, if the javascript objects are all backed by Java, then can I read the javadocs that correspond to the global objects - and assume that all the methods on those Java classes or interfaces will be available in javascript?  But that doesn't quite seem to be the case.

smacdonald2008
New Participant
October 16, 2015

dorianhallward wrote...

  • But what javascript functions (methods) are available to me on granite.currentNode? 

current node refers to the JCR node - documented here:

http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html