Skip to content

Instantly share code, notes, and snippets.

@watagashi
Created March 6, 2011 12:33
Show Gist options
  • Save watagashi/857254 to your computer and use it in GitHub Desktop.
Save watagashi/857254 to your computer and use it in GitHub Desktop.
twicli でクロスドメイン JavaScript コールバックのデフォルトのリトライ回数を変更。
xds.retry = 1;
xds.load_default = function(url, callback, old, callback_key) {
this.abort(old);
return this.load(url, callback, twFail, this.retry, callback_key);
};
xds.load_for_tab = function(url, callback, callback_key) { // タブ切替時に自動abort
var ifr_tab = this.ifr_tab;
var fr = [this.load(url,
function() { callback.apply(this,arguments); try { ifr_tab.remove(fr[0]); } catch(e) {} },
function() { twFail(); try { ifr_tab.remove(fr[0]); } catch(e) {} },
this.retry, callback_key)];
this.ifr_tab.push(fr[0]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment