Javascript utility functions for limiting high-frequency invocations