Я использовал общую функцию газа
_self.throttle = function (fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last,
deferTimer;
return function () {
var context = scope || this;
var now = +new Date,
args = arguments;
if (last && now < last + threshhold) {
// hold on to it
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
fn.apply(context, args);
}, threshhold);
} else {
last = now;
fn.apply(context, args);
}
};
};
и связал ее с
myPlayer.on('timeupdate', window.vm.throttle(function () {
window.vm.setWatched(myPlayer.currentTime());
}, 3000));
надеюсь, что это кому-нибудь поможет.
код, набранный с http://remysharp.com/2010/07/21/throttling-function-calls/