1.3.8
◀Back | Minified | Changelog | Cautionlog2013-01-13
New caching mechanism
The Function#throttle method was intended as a way to rate limit heavy operations, however not much thought was given to the returned value. v1.3.8 adds a mechanism that memoizes the result of a throttled function so that it will always return the last calculated value. This means that it can now be used as a way to cache a value for a specific period of time:
var cachedOperation = heavyOperation.throttle(5000);
cachedOperation(); // Runs the operation
cachedOperation(); // Returns the result of the last operation
setTimeout(function() {
cachedOperation(); // Runs the operation again
}, 6000);
Function#once now makes use of this mechanism internally. It is now equivalent to .throttle(Infinity), or in other words a cached function that never expires.
Bugfixes
- Updating
Date#setWeek(nowDate#setISOWeek) to follow ISO-8601 standard. - Renamed
Date#getWeekandDate#setWeektoDate#getISOWeekandDate#setISOWeek. - Performance improvement to return early using typeof for type checks.
- Performance improvement for loops.
- Fix for Array#sample sometimes returning undefined.
- Fix for French locales.
- Fix for conflict with Coffeescript.
- Fix for Object.clone not preserving date _utc flag.