Expand my Community achievements bar.

SOLVED

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

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

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

Avatar

Level 4

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.

Avatar

Level 10

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