That won't work for the built-in throttle method.
It's not hard to build this yourself. For example, here's some code that will allow you to call .throttle on any observable, passing an a throttle time observable which can be changed at will:
ko.subscribable.fn.throttle = function(throttleTimeObservable) {
var subscribable = this;
var throttledObservable = ko.observable();
var timeoutHandle = null;
if (ko.isObservable(throttleTimeObservable)) {
throttletimeObservable.subscribe(function() { clearTimeout(timeoutHandle) });
}
subscribable.subscribe(function(val) {
clearTimeout(timeoutHandle);
throttleTime = ko.utils.unwrapObservable(throttleTimeObservable);
timeoutHandle = setTimeout(function() { throttledObservable(val); }, throttleTime);
});
return throttledObservable;
}
Using it is simple:
// Usage:
var existingObservable = ...;
var throttleTime = ko.observable(500);
var throttled = existingObservable.throttle(throttleTime);
// Change the throttle willy nilly!
throttleTime(1000);
If you're doing lots of stuff like this (throttling, composing different observables together), you might be interested in Rx.js.