Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JakubJarabica/11232765 to your computer and use it in GitHub Desktop.
Save JakubJarabica/11232765 to your computer and use it in GitHub Desktop.
(function($, undefined) {
$.nette.ext('selectiveUnique', {
start: function(xhr, settings) {
if (!settings.uniqueTag || typeof settings.uniqueTag !== 'string')
return;
if (this.xhrs[settings.uniqueTag]) {
this.xhrs[settings.uniqueTag].abort();
}
this.xhrs[settings.uniqueTag] = xhr;
},
complete: function(xhr, status, settings) {
if (!settings.uniqueTag || typeof settings.uniqueTag !== 'string')
return;
this.xhrs[settings.uniqueTag] = null;
}
},
{
xhrs: {}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment