Wraps a function to allow it to be called, at most, once per interval. If the wrapper function is called more than once, only the first call will go through, and no subsequent invocations will have an effect until the interval has elapsed. This can be used to ensure a function that is expensive to run executes immediately but doesn't execute repeatedly.
Example use: For the callback to a click on a ui.Button, in order to prevent the button from being accidentally double-clicked and the callback running twice.
Returns the rate-limited function.
Function to call.
After the function is called and executed, the number of milliseconds to delay before allowing an additional invocation of the function.
Object in whose scope to call the function.