discard_late

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
discard_late [2011/01/05 22:38]
aspectscript
— (current)
Line 1: Line 1:
-Web applications typically update data from servers (eg. whether, time).  Developers has to overcome the issue of using obsolete data due to a late response of a server. For 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 javascript> 
-var discardLate = function(jp) { 
-  if(!this.isLate(jp)){     //is obsolete this join point? 
-    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> 
  • discard_late.1294267128.txt.gz
  • Last modified: 2011/01/05 22:38
  • by aspectscript