Out-of-the-box when a Knockout observable changes, any computed observable is notified immediately. In case you want to delay change notifications for a specified period of time, you can use the rateLimit extender.
The rateLimit
extender can be applied to any type of observable, including observable arrays and computed observables.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = ko.observable('Bart').extend({ rateLimit: 500 }); | |
//Name will only change to uppercase after 0.5 seconds | |
var upperCaseName = ko.computed(function() { | |
return name().toUpperCase(); | |
}); | |