Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial [2009/09/16 06:01] aspectscript |
tutorial [2009/10/26 17:55] (current) aspectscript |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Tutorial ====== | ====== Tutorial ====== | ||
- | Here, you can find a small tutorial of AspectScript. | + | ===== Getting Started ===== |
- | ===== Getting Start ===== | + | 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, |
- | To insert aspects, AspectScript instruments the code. This transformation can make it in two ways. The first is easier, but it is lesser efficient. The second is a little bit more complicated but it is more efficient. | + | === The easy way --- on-line transformation |
- | === The easy way === | + | |
- | This way is ideal when you are learning AspectScript or you are editing and testing | + | This option |
<code html> | <code html> | ||
<script language=" | <script language=" | ||
</ | </ | ||
- | Where the **jst.php**, PHP file available in AspectScript, | + | |
- | === The efficient way === | + | Where the **jst.php** |
- | The previous solution | + | |
+ | For instance, [[http:// | ||
+ | |||
+ | === The efficient way - off-line transformation | ||
+ | |||
+ | On-line transformation | ||
<code Bash> | <code Bash> | ||
- | cat script.js | js -f ' | + | cat script.js | js -f ' |
</ | </ | ||
- | and then, in the web page you include the new script | + | |
+ | And then, in the web page you include the transformed | ||
<code html> | <code html> | ||
- | <script language=" | + | <script language=" |
</ | </ | ||
+ | |||
+ | 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)===== | ||
- | The aspects of AspectScript are pointcut-advices pairs. The pointcuts | + | |
- | < | + | The aspects of AspectScript are just a pointcut-advice pair. Pointcuts |
- | AspectScript.after(AspectScript.Pointcuts.exec(foo), function(jp) { | + | |
- | alert(" | + | < |
- | }); | + | var pointcut = AspectScript.Pointcuts.exec(foo); |
+ | var advice | ||
+ | | ||
+ | }; | ||
+ | AspectScript.after(pointcut, | ||
</ | </ | ||
===== For More Information ===== | ===== For More Information ===== | ||
- | You want to learn more about AspectScript, | + | |
+ | This page is still under construction. | ||