RobertFischer / JQuery-PeriodicalUpdater

A port of Prototype's PeriodicalUpdater to JQuery
282 stars 50 forks source link

New feature: maxCallsCallback #28

Closed nickpearson closed 10 years ago

nickpearson commented 12 years ago

I needed a way to be notified when PeriodicalUpdater stopped checking a remote URL due to the maxCalls being reached. I added the following line, which goes at the end of the getdata function.

function getdata(force) {
  // ...
  if (force || maxCalls === 0) {
    // ...
  } else {
    pu_log("NOT sending...");
    // added the following line (like autoStopCallback)
    if (settings.maxCallsCallback) { settings.maxCallsCallback(); }
  }
}

This works for my needs, but I didn't want to do a pull request since you may want to further refine it and/or call it something different.

RobertFischer commented 10 years ago

Just pushed it: e2a88e2