- commit
- 8d7b0d54b0b01792881d257fdf5d83f4a5289807
- parent
- bf6db2b1346aaf8d771d6ced568d4f8260f84f4b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-05-06 04:08
rm stagedChanges
Diffstat
| M | static/pad.js | 11 | ++--------- |
1 files changed, 2 insertions, 9 deletions
diff --git a/static/pad.js b/static/pad.js
@@ -13,7 +13,6 @@ var el = document.querySelector('textarea');
13 13 var old = el.value;
14 14
15 15 var localChanges = [];
16 -1 var stagedChanges = [];
17 16
18 17 document.title += ' - ' + location.hash.slice(1);
19 18
@@ -76,15 +75,9 @@ via.listen(room, function(msg) {
76 75 });
77 76
78 77 setInterval(function() {
79 -1 if (localChanges.length && !stagedChanges.length) {
80 -1 stagedChanges = localChanges;
-1 78 if (localChanges.length) {
-1 79 via.send(room, {sender: id, type: 'changes', data: localChanges});
81 80 localChanges = [];
82 -1 var msg = {sender: id, type: 'changes', data: stagedChanges};
83 -1 via.send(room, msg).catch(() => {
84 -1 localChanges = stagedChanges.concat(localChanges);
85 -1 }).finally(() => {
86 -1 stagedChanges = [];
87 -1 });
88 81 }
89 82 }, 500);
90 83