This is an old revision of the document!
Tutorial
Here, you can find a small tutorial of AspectScript.
Getting Start
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
This way is ideal when you are learning AspectScript or you are editing and testing the AspectScript code on-the-fly. To use the easy way, you only have to include a JavaScript script in the following way:
<script language="javascript" src="jst.php?url=script.js"> </script>
Where the jst.php, PHP file available in AspectScript, instruments the code.
The efficient way
The previous solution is a little bit inefficient because AspectScript modifies the JavaScript code every time that the Web page is loaded. You can transform the JavaScript code once and then you only include the transformed script. To attain this, you have to execute the command:
cat script.js | js -f 'launcher.js' > newscript.js
and then, in the web page you include the new script
<script language="javascript" src="newscript.js"> </script>
Define and Deploy Aspects (Under construction)
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 see the examples or reading the technical report