code: function pageDomHasChanged(page, ph, callback) {
      var elapsed = 0;
      var waitTimeOver = false;
      var domHasChanged = false;
      var originalDom = '';
  
      async.waterfall([
          // save the initial dom
          function (callback) {
              getData.takeSnapshot(page, ph, function (error, page, ph, dom) {
                  if (error) {
                      callback (error);
                      return;
                  }
  
                  originalDom = dom;
                  callback();
              });
          },
  
          // poll the page for changes in the dom or until timeout
          function (callback) {
              async.until(
                  // conditions for stopping the poll
                  function () {
                      waitTimeOver = elapsed > constants.WAIT_TIMEOUT;
                      return waitTimeOver || domHasChanged;
                  },
                  function (callback) {
                      // polls the page at an interval
                      setTimeout(function () {
                          elapsed += constants.POLL_INTERVAL;
                          getData.takeSnapshot(page, ph, function (error, page, ph, newDom) {
                              if (error) {
                                  callback(error);
                                  return;
                              }
                              domHasChanged = helpers.domIsDifferent(originalDom, newDom);
                              callback();
                          });
                      }, constants.POLL_INTERVAL);
                  },
  
                  function (error) {
                      if (waitTimeOver) {
                          callback('Timeout while waiting for dom to change');
                          return;
                      }
                      callback(error);
                  }
              );
          }
      ], function (error) {
          callback(error, page, ph);
      });
  }
docs: Helper function to check if the DOM has changed
  Use case: Ajax function changing content of page
  @param page
  @param ph
  @param {pageCallback} callback