Is it possible to hook into the ajax wait system?

Is it possible to hook into the ajax wait system?

  
Is it possible to detect when a page has an ajax request thats still in progress?

I'd like to conditionally show/hide or enable/disable certain functionality or content based on whether an ajax request is currently in progress.  I know the ajax wait widget shows the standard "loading" piece of feedback when a request is taking a while so I wondered whether there was exposure of the data it uses (ie. whether ajax requests are in progress, how long for, etc..) so that it could be used for other things?
Hi,

The javascript below is used by RichWidget's Feedback_AjaxWait web block. If you bind your javascript code to the same events, you may be able to do what you're describing. For instance:

osAjaxBackend.BindBeforeAjaxRequest(function(){alert('ajax...');})

will display an annoying popup before each ajax request.

var RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer;
var RichWidgets_Feedback_AjaxWait_Timeout = 200;

function RichWidgets_Feedback_AjaxWait_init(divId) {
 $(function($) {
  osAjaxBackend.BindBeforeAjaxRequest(function(){
    if(RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer == null) {
       RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer = setTimeout(function () { 
            $('#' + divId).fadeIn(); 
            $('body').addClass('Feedback_AjaxWait_CursorProgress');
        } , RichWidgets_Feedback_AjaxWait_Timeout);
      window.OsOnBeforeChange = function(){
       clearTimeout(RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer);
       RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer = null;
       $('body').removeClass('Feedback_AjaxWait_CursorProgress');
       $('#' + divId ).fadeOut();
      };
      $(window).unload(function() {
       window.OsOnBeforeChange = null;
      });
      osAjaxBackend.BindAfterAjaxRequest(function(){window.OsOnBeforeChange();});        
    }
  });
 });
}

Disclaimer: keep in mind that this API can change in future platform versions.
Thanks, that looks promising and i think i'll be able to use it for my needs.