This is an old revision of the document!
Tutorial
Here, you can find a small tutorial of AspectScript. For more information, please read its technical report.
Getting Start
The code transformation can use 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
This way is ideal when you are learning AspectScript or you are editing and testing the JavaScript code. To use AspectScript, you has to include a JavaScript script in the following way: you must change that by:
<script language="javascript" src="jst.php?url=script.js"> </script>
The jst.php is the PHP file available in AspectScript
The efficient way
The inefficient of previous solution is the problem because AspectScript modifies the JavaScript code every time that the Web page is loaded. You can transform the JavaScript code once and latter you include the new script. To transform the code, you must execute the code:
cat script.js | js -f 'launcher.js' > newscript.js
In the web page you include the new script
<script language="javascript" src="newscript.js"> </script>
Define and Deploy Aspects
The aspects of AspectScript are pointcut-advices pairs. The pointcuts and advices are JavaScript functions. For instance, if you need to identify all executions of the foo function.
AspectScript.after(AspectScript.Pointcuts.exec(foo), function(jp) { alert("foo was executed"); });
For more information
You want to learn more about AspectScript, you can read the technical report