Sha256: a2ff5d4799c48da612c89ab3285d6260fc42f2c4ecf7c082c915b6802cd5405e
Contents?: true
Size: 634 Bytes
Versions: 4
Compression:
Stored size: 634 Bytes
Contents
// this allows culerity to wait until all ajax requests have finished jQuery(function($) { var original_ajax = $.ajax; var count_down = function(callback) { return function() { try { if(callback) { callback.apply(this, arguments); }; } catch(e) { window.running_ajax_calls -= 1; throw(e); } window.running_ajax_calls -= 1; } }; window.running_ajax_calls = 0; var ajax_with_count = function(options) { window.running_ajax_calls += 1; options.success = count_down(options.success); options.error = count_down(options.error); original_ajax(options); }; $.ajax = ajax_with_count; });
Version data entries
4 entries across 4 versions & 2 rubygems