Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Commit 8f35a55

Browse files
authored
Merge pull request #39 from servusoft/master
small optimization on typing
2 parents c3b310d + 7f2efa5 commit 8f35a55

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

static/js/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ $(function() {
3535
editor.getSession().setMode("ace/mode/markdown");
3636
editor.getSession().setUseWrapMode(true);
3737
editor.setShowPrintMargin(true);
38-
3938
$.get('/slides.md', function(data) {
4039
editor.setValue(data, -1);
4140
});
42-
41+
var lastSRow = -1;
4342
ace.edit('editor').getSession().selection.on('changeCursor', function(e) {
4443
var cursorRow = ace.edit('editor').getCursorPosition().row;
44+
if(lastSRow === cursorRow){
45+
return; // no update
46+
}
47+
lastSRow = cursorRow;
4548
var currentSlide = currentCursorSlide(cursorRow);
4649
$('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({
4750
method: 'slide',

static/js/save.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ $(function() {
1515
});
1616
};
1717

18-
$('#editor').keyup($.debounce(window.save, 300));
18+
$('#editor').keyup($.debounce(window.save, 600));
1919
});

0 commit comments

Comments
 (0)