Skip to content

Commit

Permalink
[NNotepad] Debounced refresh() (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibelem authored Jun 25, 2024
1 parent ea4b02b commit 2fcce9e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nnotepad/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ document.addEventListener('DOMContentLoaded', async (e) => {
disableMonospaceOptimizations: true,
});

editor.onDidChangeModelContent(() => {
refresh();
});
const debouncedRefresh = Util.debounce(refresh, 500);
editor.onDidChangeModelContent(debouncedRefresh);

async function refresh(e) {
const code = editor.getValue();
Expand Down

0 comments on commit 2fcce9e

Please sign in to comment.