Classic debounce — delay invoking fn until X ms after the last call.
Cache an expensive call with the `||=` idiom.