vzcode 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server/index.js +5 -3
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -69,7 +69,7 @@ let previousDocument = initialDocument;
|
|
|
69
69
|
|
|
70
70
|
// Saves the files that changed.
|
|
71
71
|
const save = () => {
|
|
72
|
-
|
|
72
|
+
console.log('saving');
|
|
73
73
|
const currentDocument = shareDBDoc.data;
|
|
74
74
|
|
|
75
75
|
// Take a look at each file (key) previously and currently.
|
|
@@ -78,8 +78,8 @@ const save = () => {
|
|
|
78
78
|
...previousDocument.files,
|
|
79
79
|
});
|
|
80
80
|
for (const key of allKeys) {
|
|
81
|
-
const previous = previousDocument[key];
|
|
82
|
-
const current = currentDocument[key];
|
|
81
|
+
const previous = previousDocument.files[key];
|
|
82
|
+
const current = currentDocument.files[key];
|
|
83
83
|
|
|
84
84
|
// If this file was neither created nor deleted...
|
|
85
85
|
if (previous && current) {
|
|
@@ -125,6 +125,7 @@ let lastExecutedTime = Date.now();
|
|
|
125
125
|
|
|
126
126
|
// Function to throttle the saving
|
|
127
127
|
function throttleSave() {
|
|
128
|
+
console.log('throttling');
|
|
128
129
|
const now = Date.now();
|
|
129
130
|
if (now - lastExecutedTime > throttleTimeMS) {
|
|
130
131
|
save();
|
|
@@ -135,6 +136,7 @@ function throttleSave() {
|
|
|
135
136
|
// Function to debounce the saving
|
|
136
137
|
let debounceTimeout;
|
|
137
138
|
function debounceSave() {
|
|
139
|
+
console.log('debouncing');
|
|
138
140
|
clearTimeout(debounceTimeout);
|
|
139
141
|
debounceTimeout = setTimeout(save, autoSaveDebounceTimeMS);
|
|
140
142
|
}
|