extensions/angoose-ui/services/ui-service.js
function debounce(quietMillis, fn, ctx ) {
    ctx = ctx || undefined;
    var timeout;
    return function () {
        var args = arguments;
        clearTimeout(timeout);
        timeout = setTimeout(function() {
            fn.apply(ctx, args);
        }, quietMillis);
    };
}
function debounce(quietMillis, fn, ctx ) {
    ctx = ctx || undefined;
    var timeout;
    return function () {
        var args = arguments;
        clearTimeout(timeout);
        timeout = setTimeout(function() {
            fn.apply(ctx, args);
        }, quietMillis);
    };
}
Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
within the last quietMillis milliseconds.

@param quietMillis number of milliseconds to wait before invoking fn
@param fn function to be debounced
@param ctx object to be used as this reference within fn
@return debounced version of fn