Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
tutorial [2009/09/25 16:01] 127.0.0.1 external edit |
tutorial [2009/10/26 17:55] (current) aspectscript |
===== Getting Started ===== | ===== Getting Started ===== |
| |
To insert aspects, AspectScript needs an instrumentation phase. This instrumentation can be performed in two ways. The first is easier, but less efficient (useful for development). The second is a little bit more complicated, but more efficient (choose this one for production code). | In order to be able to dynamically weave aspects without modifying a particular JavaScript engine, AspectScript first performs a code transformation phase in which some expressions are rewritten. This instrumentation can be performed in two ways. The first is easier, but less efficient (useful for development). The second is a little bit more complicated, but more efficient (choose this one for production code). |
| |
=== The easy way - on-line transformation === | === The easy way --- on-line transformation === |
| |
This way is ideal when you are learning AspectScript or you are developing code, because the transformationis peformed each time your Javascript script is loaded. For on-line tranformation, it is only necessary to include the JavaScript script in the following way: | This option is ideal when you are learning AspectScript or you are developing code, because the code is transformed each time your Javascript script is loaded. For on-line tranformation, it is only necessary to include the JavaScript source in the following way: |
| |
<code html> | <code html> |
| |
Where the **jst.php** is the PHP file available in the standard distribution of AspectScript. | Where the **jst.php** is the PHP file available in the standard distribution of AspectScript. |
| |
| For instance, [[http://www.pleiad.cl/aspectscript/external/tetris/tetris.js|this]] is the original tetris application, and the [[http://www.pleiad.cl/aspectscript/external/aspectscript/jst.php?url=http://www.pleiad.cl/aspectscript/external/tetris/tetris.js|transformed one]] using jst.php (it can take some time to load because the transformation is a heavy process, please click once). |
| |
=== The efficient way - off-line transformation === | === The efficient way - off-line transformation === |
| |
On-line transformatio is a little bit inefficient because the JavaScript script is transformed each time it is requested (on every page load). As an altenative, Javascript scripts can be transformed once and then include the transformed script. To attain this, you have to execute the following: | On-line transformation is a little bit inefficient because the scripts are transformed each time they are requested (on every page load). As an altenative, Javascript scripts can be transformed once and then the transformed code included in pages. The following commands performs this off-line transformation: |
| |
<code Bash> | <code Bash> |
</code> | </code> |
| |
The **launcher.js** script is included in the standard AspectScript distribution. | The **launcher.js** script and the **js** executable are included in the standard AspectScript distribution. |
| |
===== Define and Deploy Aspects (Under Construction)===== | ===== Define and Deploy Aspects (Under Construction)===== |
===== For More Information ===== | ===== For More Information ===== |
| |
If you want to learn more about AspectScript, you can see the [[examples|examples]] page or read the [[technical report|technical report]]. | This page is still under construction. Please see the [[examples|examples]] page if you want to learn more about AspectScript. |
| |
| |