throttle markdown preview

This commit is contained in:
ansuz
2017-05-24 11:27:16 +02:00
parent d49e6deffb
commit dc80b6b11f
3 changed files with 16 additions and 3 deletions

View File

@@ -122,5 +122,14 @@ define([], function () {
xhr.send(null);
};
Util.throttle = function (f, ms) {
var to;
var g = function () {
window.clearTimeout(to);
to = window.setTimeout(f, ms);
};
return g;
};
return Util;
});