Skip to content

Instantly share code, notes, and snippets.

@matopeto
Created April 2, 2014 15:06
Show Gist options
  • Save matopeto/9936055 to your computer and use it in GitHub Desktop.
Save matopeto/9936055 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