You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2016/04/20 11:17:25 UTC

svn commit: r1740073 - /sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext

Author: radu
Date: Wed Apr 20 09:17:24 2016
New Revision: 1740073

URL: http://svn.apache.org/viewvc?rev=1740073&view=rev
Log:
added info about accessing Java API from JavaScript with Sightly

Modified:
    sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext

Modified: sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext?rev=1740073&r1=1740072&r2=1740073&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext Wed Apr 20 09:17:24 2016
@@ -218,7 +218,7 @@ or, if the object is adaptable from a `S
     }
 
 ### JavaScript Use Provider
-The JavaScript Use Provider allows loading objects created through the `use` function, by evaluating scripts passed to `data-sly-use`.
+The JavaScript Use Provider allows loading objects created through the `use` function, by evaluating scripts passed to `data-sly-use`. The JavaScript files are evaluated server-side by the [Rhino](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino) scripting engine, through the `org.apache.sling.scripting.javascript` implementation bundle. This allows you to mix JavaScript API with the Java API exported by the platform. For more details about how you can access Java APIs from within JavaScript please check the [Rhino Java Scripting guide](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Scripting_Java#Accessing_Java_Packages_and_Classes).
 
 **Example:**
 Assuming the following content structure:
@@ -283,8 +283,6 @@ the object would be able to access the p
 
 #### Caveats
 
-The JavaScript files are evaluated by the [Rhino](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino) scripting engine, through the `org.apache.sling.scripting.javascript` implementation bundle.
-
 Since these scripts are evaluated server-side, by compiling JavaScript to Java, you need to pay attention when comparing primitive objects using the strict equal operator (`===`) since comparisons between JavaScript and Java objects with the same apparent value will return `false` (this also applies to the strict not-equal operator - `!==`).
 
 Assuming the following Sightly script: