feat($resource): Allow functions in action timeout

Support functions when configuring actions. This allows the timeout to change with time, when the function returns a number, and allows an action to be cancelled multiple times, when the function returns a new promise.

Closes #7974
I don't think that this is a particularly generic callback. it's rare to test that a callback was called twice. And when we do usually at that point we care what the arguments were, etc and use a logger instead.