function _throttle($function, $wait) { return Underscore::throttle($function, $wait); }
/** * @tags functions */ public function testThrottle() { // it should return a throttled version of the function $count = 0; $fn = _::throttle(function () use(&$count) { $count++; }, 10); // once every 10ms $start = microtime(true); do { $fn(); } while ((microtime(true) - $start) * 1000 < 100); // 100ms $this->integer($count)->isGreaterThan(0)->isLessThanOrEqualTo(10); }