You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bu...@apache.org on 2015/04/13 03:19:49 UTC
svn commit: r947357 - in /websites/production/tapestry/content:
cache/main.pageCache coffeescript.html javascript-modules.html
javascript.html
Author: buildbot
Date: Mon Apr 13 01:19:48 2015
New Revision: 947357
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/coffeescript.html
websites/production/tapestry/content/javascript-modules.html
websites/production/tapestry/content/javascript.html
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/tapestry/content/coffeescript.html
==============================================================================
--- websites/production/tapestry/content/coffeescript.html (original)
+++ websites/production/tapestry/content/coffeescript.html Mon Apr 13 01:19:48 2015
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css">
+ <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
+ <script type="text/javascript">
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -57,7 +67,103 @@
</div>
<div id="content">
-<div id="ConfluenceContent"><p><a shape="rect" class="external-link" href="http://coffeescript.org" >CoffeeScript</a> is a language to compiles down to JavaScript.</p><p>It can be quite controversial, but also quite effective.</p><p>On the controversial side, it uses significant whitespace to denote blocks of code (like Python or Haskell) rather than curl braces (like Java, JavaScript, or Ruby). In fact, it draws influences from a wide rage of other languages, incorporating many functional programming features, a rudimentary class system, string interpolation, destructuring assignment, and more.</p><p>However, for all that, it is very close to JavaScript; it simply rounds out many of the rough edges of JavaScript (and adds a few of its own). As wide ranging as CoffeeScript syntax can be, there's generally a very close mapping from CoffeeScript to JavaScript.</p><p>CoffeeScript code often approaches Python's goal of being a "executable psuedo-code"; code that looks like a placeholder
will actually run. Some people find it more pleasant to read than JavaScript ... more <em>essence</em> and less <em>ceremony</em>.</p><p>You can still write bad code in CoffeeScript. You can write bad code in any language.</p><p>All of Tapestry's client-side code in written in CoffeeScript and compiled, at build-time, to JavaScript.</p><p>The tapestry-web-resources module adds the ability to dynamically compile CoffeeScript to JavaScript in the running application, It is recommended for anyone who wants to use CoffeeScript in their application ... just do the compilation at runtime (with access to Tapestry's full exception reporting capabilities).</p></div>
+<div id="ConfluenceContent"><div class="navmenu" style="float:right; background:#eee; margin:3px; padding:3px">
+<h3>Related Articles</h3>
+<ul class="content-by-label"><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="ajax-and-zones.html">Ajax and Zones</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="legacy-javascript.html">Legacy JavaScript</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="ajax-components-faq.html">Ajax Components FAQ</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="javascript-faq.html">JavaScript FAQ</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="client-side-javascript.html">Client-Side JavaScript</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="assets.html">Assets</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="component-cheat-sheet.html">Component Cheat Sheet</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="javascript-modules.html">JavaScript Modules</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon icon-page" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a shape="rect" href="coffeescript.html">CoffeeScript</a>
+
+
+ </div>
+ </li></ul>
+</div><p><strong>CoffeeScript</strong> (<a shape="rect" class="external-link" href="http://coffeescript.org" >http://coffeescript.org</a>) is a language that to compiles down to JavaScript.</p><p>Tapestry can automatically compile your CoffeeScript code into JavaScript on the fly. This is done with the optional tapestry-webresources module. It is recommended for anyone who wants to use CoffeeScript in their application ... just let Tapestry do the compilation at runtime (with access to Tapestry's full exception reporting capabilities).</p><p>To use the tapestry-webresources module, just add the JAR to your project. For example, if you're using Maven:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>pom.xml (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-webresources</artifactId>
+ <version>${tapestry-release-version}</version>
+</dependency>]]></script>
+</div></div><p>All of Tapestry's own client-side code in written in CoffeeScript and compiled, at build-time, to JavaScript.</p> <div class="aui-message warning shadowed information-macro">
+ <span class="aui-icon icon-warning">Icon</span>
+ <div class="message-content">
+ <p>You are completely free to use either JavaScript or CoffeeScript in your Tapestry application.</p>
+ </div>
+ </div>
+<h2 id="CoffeeScript-CoffeeScriptversusJavaScript">CoffeeScript versus JavaScript</h2><p>CoffeeScript can be quite controversial, but also quite effective.</p><p>On the controversial side, it uses significant whitespace to denote blocks of code (like Python or Haskell) rather than curl braces (like Java, JavaScript, or Ruby). In fact, it draws influences from a wide rage of other languages, incorporating many functional programming features, a rudimentary class system, string interpolation, destructuring assignment, and more.</p><p>However, for all that, it is very close to JavaScript; it simply rounds out many of the rough edges of JavaScript (and adds a few of its own). As wide ranging as CoffeeScript syntax can be, there's generally a very close mapping from CoffeeScript to JavaScript.</p><p>CoffeeScript code often approaches Python's goal of being a "executable psuedo-code"; code that looks like a placeholder that will actually run. Some people find it more pleasant to read than
JavaScript ... more <em>essence</em> and less <em>ceremony</em>.</p><p>You can still write bad code in CoffeeScript. You can write bad code in any language.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/javascript-modules.html
==============================================================================
--- websites/production/tapestry/content/javascript-modules.html (original)
+++ websites/production/tapestry/content/javascript-modules.html Mon Apr 13 01:19:48 2015
@@ -118,7 +118,7 @@ $("#helpButton").click(onClick
<p>With AMD, the JavaScript libraries may be loaded in parallel by the browser (that's the <em>asynchronous</em> part of AMD); RequireJS manages the dependency graph and invokes each function just once, as soon as its dependencies are ready, as libraries are loaded. In some cases, a module may be loaded just for its side effects; such modules will be listed last in the dependency array, and will not have a corresponding parameter in the dependent module's constructor function. In <code>confirm-click</code>, the <code>bootstrap/modal</code> module is loaded for side-effects.</p>
</div>
</div>
-<p><code>confirm-click</code> defines a local function, <code>runDialog</code>. It performs some side-effects, attaching event handlers to the body and the document. The module's export is a JavaScript object containing a function that allows other modules to raise the modal dialog.</p><p>If a module truly exports only a single function and is unlikely to change, then it is acceptable to just return the function itself, not an object containing the function. However, returning an object makes it easier to expand the responsibilities of <code>confirm-click</code> in the future; perhaps to add a <code>dismissDialog</code> function.</p><h3 id="JavaScriptModules-LocationofModules">Location of Modules</h3><p>Modules are stored as a special kind of Tapestry <a shape="rect" href="assets.html">asset</a>. On the server, modules are stored on the class path under <code>META-INF/modules</code>. In a typical environment, that means the sources will be in <code>src/main/resources/META-INF/module
s</code>.</p><p>Typically, your application will place it's modules directly in this folder. If you are writing a reusable library, you will put modules for that library into a subfolder to prevent naming conflicts. Tapestry's own modules are prefixed with <code>t5/core</code>.</p><p>If you are using the optional <code>tapestry-web-resources</code> module (that's a server-side module, not an AMD module), then you can write your modules as CoffeeScript files; Tapestry will take care of compiling them to JavaScript as necessary.</p><p>The service <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/services/javascript/ModuleManager.html">ModuleManager</a> is the central piece of server-side support for modules. It supports <em>overriding</em> of existing modules by contributing overriding <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/services/javascript/JavaScriptModu
leConfiguration.html">module definitions</a>. This can be useful to <a shape="rect" class="external-link" href="http://en.wikipedia.org/wiki/Monkey_patch" >monkey patch</a> an existing module supplied with Tapestry, or as part of a third-party library.</p><h3 id="JavaScriptModules-LoadingModulesfromTapestryCode">Loading Modules from Tapestry Code</h3><p>Often, you will have a Tapestry page or component that defines client-side behavior; such a component will need to load a module.</p><p>The simplest approach is to use the <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/annotations/Import.html">Import</a> annotation:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<p><code>confirm-click</code> defines a local function, <code>runDialog</code>. It performs some side-effects, attaching event handlers to the body and the document. The module's export is a JavaScript object containing a function that allows other modules to raise the modal dialog.</p><p>If a module truly exports only a single function and is unlikely to change, then it is acceptable to just return the function itself, not an object containing the function. However, returning an object makes it easier to expand the responsibilities of <code>confirm-click</code> in the future; perhaps to add a <code>dismissDialog</code> function.</p><h3 id="JavaScriptModules-LocationofModules">Location of Modules</h3><p>Modules are stored as a special kind of Tapestry <a shape="rect" href="assets.html">asset</a>. On the server, modules are stored on the class path under <code>META-INF/modules</code>. In a typical environment, that means the sources will be in <code>src/main/resources/META-INF/module
s</code>.</p><p>Typically, your application will place it's modules directly in this folder. If you are writing a reusable library, you will put modules for that library into a subfolder to prevent naming conflicts. Tapestry's own modules are prefixed with <code>t5/core</code>.</p><p>If you are using the optional <code><a shape="rect" href="coffeescript.html">tapestry-web-resources</a></code> module (that's a server-side module, not an AMD module), then you can write your modules as CoffeeScript files; Tapestry will take care of compiling them to JavaScript as necessary.</p><p>The service <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/services/javascript/ModuleManager.html">ModuleManager</a> is the central piece of server-side support for modules. It supports <em>overriding</em> of existing modules by contributing overriding <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache
/tapestry5/services/javascript/JavaScriptModuleConfiguration.html">module definitions</a>. This can be useful to <a shape="rect" class="external-link" href="http://en.wikipedia.org/wiki/Monkey_patch" >monkey patch</a> an existing module supplied with Tapestry, or as part of a third-party library.</p><h3 id="JavaScriptModules-LoadingModulesfromTapestryCode">Loading Modules from Tapestry Code</h3><p>Often, you will have a Tapestry page or component that defines client-side behavior; such a component will need to load a module.</p><p>The simplest approach is to use the <a shape="rect" class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/annotations/Import.html">Import</a> annotation:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Import(module = "t5/core/confirm-click")
public class Confirm
{
Modified: websites/production/tapestry/content/javascript.html
==============================================================================
--- websites/production/tapestry/content/javascript.html (original)
+++ websites/production/tapestry/content/javascript.html Mon Apr 13 01:19:48 2015
@@ -57,7 +57,7 @@
</div>
<div id="content">
-<div id="ConfluenceContent"><p>The Tapestry documentation is being reorganized. For the JavaScript topic, please see one of the following pages:</p><ul><li><span><span style="color: rgb(0,0,0);"><a shape="rect" href="client-side-javascript.html">Client-Side JavaScript</a></span><span style="color: rgb(0,0,0);"> (Tapestry 5.4 and newer)</span></span></li><li><span style="color: rgb(0,0,0);"><a shape="rect" href="legacy-javascript.html">Legacy JavaScript</a> (prior to Tapestry 5.4)</span><span><span style="color: rgb(0,0,0);"><br clear="none"></span></span></li></ul></div>
+<div id="ConfluenceContent"><p>The Tapestry documentation is being reorganized. For the JavaScript topic, please see one of the following pages:</p><ul><li><span><span style="color: rgb(0,0,0);"><a shape="rect" href="client-side-javascript.html">Client-Side JavaScript</a></span><span style="color: rgb(0,0,0);"> (Tapestry 5.4 and newer)</span></span></li><li><span style="color: rgb(0,0,0);"><a shape="rect" href="legacy-javascript.html">Legacy JavaScript</a> (prior to Tapestry 5.4)</span><span><span style="color: rgb(0,0,0);"> </span></span></li><li><span><span style="color: rgb(0,0,0);"><a shape="rect" href="coffeescript.html">CoffeeScript</a><br clear="none"></span></span></li></ul></div>
</div>
<div class="clearer"></div>