From 2ccb8ec75cb880369fef938780ede5ede262f593 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 6 Jul 2020 15:30:27 -0400 Subject: [PATCH] throttle redraws of the slide content draw no more than once every 400ms --- www/slide/inner.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/www/slide/inner.js b/www/slide/inner.js index 4b1161b9a..4b7691ced 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -485,15 +485,19 @@ define([ CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar); CodeMirror.configureTheme(common); + var drawSlides = Util.throttle(function (content) { + Slide.update(content); + }, 400); + framework.onContentUpdate(function (newContent) { CodeMirror.contentUpdate(newContent); - Slide.update(newContent.content); + drawSlides(newContent.content); }); framework.setContentGetter(function () { CodeMirror.removeCursors(); var content = CodeMirror.getContent(); - Slide.update(content.content); + drawSlides(content.content); return content; });