Improved Asynchronous Calls with nano.js September 6, 2016

The Nano AJAX Library has recently received 3 updates, all related to concurrent asynchronous calls.

1. Cross-domain requests with xajx:

The xajx function creates a one-time transport DOM element. It then injects script blocks. The injected script block invokes a call to an existing JavaScript function, and is subsequently discarded.

In Internet Explorer, the disposal of this transport element turns out to be too soon when there is a secondary request racing the previous one. The improved xajx function waits for the injection calls to "settle" before emptying the transport container. Now cross-domain calls can take place in parallel, even in IE.

2. Abort the call, not the content:

The ajxpgn function guarantees the in-order display of racing requests. If one request runs for a long time, the next request aborts the previous one. The user sees the result that corresponds to the latest request. When an in-flight request is aborted, the ajxpgn loader is also wiped out. The user sees a blank element until the next request returns. In a high latency environment the disappearance of the loader content is more noticeable. The new version of nano.js only aborts the call. The content stays unchanged until the return of the most recent update.

3. The "run once" mode:

Certain requests can be made repeatedly without changing the final result. These are known as |idempotent calls". Ideally we should avoid making redundant calls, but we cannot control end user behavior. If they double-click that Send Message button, two messages will be sent instead of one. Combining the new behavior that's mentioned in #2, and slow server response, the user could be hitting the button repeatedly. If this is a "Place Order" button, oh boy get your customer service folks ready.

In nano.js v2.3, you can block out later arrivals until the first request has made it through. This is in contrary to "aborting previous calls" behavior where aborted calls are nevertheless processed by the server, albeit not shown in the front-end.

The "run-once" argument is the last parameter, after C-U-D-E, data, func and timeout. For example:

ajxpgn('loader','purchase.php?', 0,0, data, null,null, 1);

The timeout argument is reserved in the Gyroscope variant, but the function signatures are unified in both versions.

 

Our Services

Targeted Crawlers

Crawlers for content extraction, restoration and competitive intelligence gathering.

Learn More

Gyroscope™ ERP Solutions

Fully integrated enterprise solutions for rapid and steady growth.

Learn More

E-Commerce

Self-updating websites with product catalog and payment processing.

Learn More