Optional
areFunction to be wrapped
Optional
updateOptional function to update the arguments.
By default, when new calls are made while the previous call is being executed,
The function will be executed again with the latest arguments. This function
is used to change this behavior and is called when new calls are made. In other words,
the default value for this function is (_current, _middle, latest) => latest
.
The arguments are:
current
: The arguments of the call currently being executedlatest
: The argument of this new callmiddle
: If more than one call is made while the previous call is being executed,
this array contains arguments of the calls between current
and latest
next
: This is the returned value of the previous call to updateArgs, i.e. the args
to be executed next.
Optional function to compare if arguments of 2 calls are equal.
By default, separate calls are considered different, and the result of the latest call will be returned. However, if the function is pure, and the argument of a new call is the same as the call being executed, then the result of the call being executed will be returned. In other words, the new call will not result in another execution of the function.