throttle redraws of the slide content

draw no more than once every 400ms
pull/1/head
ansuz 5 years ago
parent 02d8071c5d
commit 2ccb8ec75c

@ -485,15 +485,19 @@ define([
CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar); CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar);
CodeMirror.configureTheme(common); CodeMirror.configureTheme(common);
var drawSlides = Util.throttle(function (content) {
Slide.update(content);
}, 400);
framework.onContentUpdate(function (newContent) { framework.onContentUpdate(function (newContent) {
CodeMirror.contentUpdate(newContent); CodeMirror.contentUpdate(newContent);
Slide.update(newContent.content); drawSlides(newContent.content);
}); });
framework.setContentGetter(function () { framework.setContentGetter(function () {
CodeMirror.removeCursors(); CodeMirror.removeCursors();
var content = CodeMirror.getContent(); var content = CodeMirror.getContent();
Slide.update(content.content); drawSlides(content.content);
return content; return content;
}); });

Loading…
Cancel
Save