This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
discard_late [2011/01/05 22:27] aspectscript |
— (current) |
Using Ajax technologies, web applications normally load data from servers. As an example, consider a website that shows the current time of a certain country using two Ajax requests. If the response second request arrives before than the response the first ajax request arrive, the showed time will be incorrect. Using a customized strategy, named **discardLate**, of ordering that discard the obsolete response, we can avoid aforementioned problem. | |
| |
<code java> | |
var discardLate= function(jp) { | |
if(!this.isLate(jp)){ | |
jp.proceed(); | |
this.updateCr(jp); //notifies that join point was executed. | |
} | |
} | |
</code> | |
| |
| |
| |
The implementation follows: | |
<html> | |
<link href="/aspectscript/external/otm/paperExample-SPE/order/style.css" rel="stylesheet" type="text/css"/> | |
<script type="text/javascript" language="javascript" src="/aspectscript/external/otm/paperExample-SPE/order/lib.js"> </script> | |
<iframe id="example" src="/aspectscript/external/otm/paperExample-SPE/order/discardLate" width="810" height="170"></iframe> | |
<iframe id="code" style="display:none" src="/aspectscript/external/otm/paperExample-SPE/order/discardLate/script.js" width="810" height="470"></iframe> | |
<a id="button" class="button" onclick="toggle('code','example')"> <span>Toggle between the code and example </span></a> | |
</html> | |