https://rawb.codeplex.com/SourceControl/latest#Rawb/Rawb/js/rawb.util.js
rawb.nonOverlappingAsync(async, throttle)
Construct an asynchronous function taking pass/fail callbacks
such that only the last in any sequence of overlapping
calls is processed.
To be more precise, if
g = rawb.nonOverlappingAsync(f, n) then
calling
g(x, pass, fail) will have the following behaviour:
- nothing will happen for at least n milliseconds; then
- nothing will happen if any calls to g have been made in the intervening period;
- otherwise f(x, passX, failX) will be invoked where passX and failX are the same as pass and fail respectively except that nothing will happen if any calls to g have been made in the period between f being invoked and passX or failX being invoked by f.
Parametersasync: function(arg, pass, fail)An asynchronous function (typically an AJAX request) taking an
argument
arg and
pass and
fail callbacks. If the call
succeeds,
async should call
pass with the response; if the
call fails,
async should call
fail with the reason.
throttle: numberOptional (default 0).
The number of milliseconds to defer calling
async. If this
argument is omitted or is not a positive number, then
asyncis called immediately.