j-templates 8.0.3 → 8.0.5
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/Utils/emitter.js +18 -2
- package/Utils/json.js +5 -5
- package/package.json +1 -1
package/Utils/emitter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Emitter = void 0;
|
|
4
|
+
const array_1 = require("./array");
|
|
4
5
|
const scheduling_1 = require("./scheduling");
|
|
5
6
|
const pendingCompactEmitters = new Set();
|
|
6
7
|
function Compact(emitter) {
|
|
@@ -39,9 +40,17 @@ var Emitter;
|
|
|
39
40
|
emitter.push(callback);
|
|
40
41
|
}
|
|
41
42
|
Emitter.On = On;
|
|
43
|
+
const emitterStack = [];
|
|
44
|
+
const modifiedDuringEmit = new Set();
|
|
42
45
|
function Emit(emitter, ...args) {
|
|
46
|
+
emitterStack.push(emitter);
|
|
43
47
|
for (let x = emitter[0] + 1; x < emitter.length; x++)
|
|
44
|
-
emitter[x](...args);
|
|
48
|
+
emitter[x]?.(...args);
|
|
49
|
+
emitterStack.pop();
|
|
50
|
+
if (modifiedDuringEmit.delete(emitter)) {
|
|
51
|
+
(0, array_1.RemoveNulls)(emitter);
|
|
52
|
+
emitter[0] = 0;
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
55
|
Emitter.Emit = Emit;
|
|
47
56
|
function Remove(emitter, callback) {
|
|
@@ -49,12 +58,19 @@ var Emitter;
|
|
|
49
58
|
return;
|
|
50
59
|
const startIndex = emitter[0] + 1;
|
|
51
60
|
const index = emitter.indexOf(callback, startIndex);
|
|
52
|
-
if (index
|
|
61
|
+
if (index < 1)
|
|
62
|
+
return;
|
|
63
|
+
const emitterStackIndex = emitterStack.indexOf(emitter);
|
|
64
|
+
if (emitterStackIndex < 0) {
|
|
53
65
|
emitter[0]++;
|
|
54
66
|
emitter[index] = emitter[startIndex];
|
|
55
67
|
emitter[startIndex] = null;
|
|
56
68
|
Compact(emitter);
|
|
57
69
|
}
|
|
70
|
+
else {
|
|
71
|
+
emitter[index] = null;
|
|
72
|
+
modifiedDuringEmit.add(emitter);
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
75
|
Emitter.Remove = Remove;
|
|
60
76
|
function Clear(emitter) {
|
package/Utils/json.js
CHANGED
|
@@ -171,11 +171,6 @@ function JsonDiffFactory() {
|
|
|
171
171
|
return oldValue.length !== newValue.length;
|
|
172
172
|
}
|
|
173
173
|
let allChildrenChanged = true;
|
|
174
|
-
if (newValue.length !== oldValue.length)
|
|
175
|
-
resp.push({
|
|
176
|
-
path: path.concat("length"),
|
|
177
|
-
value: newValue.length,
|
|
178
|
-
});
|
|
179
174
|
if (newValue.length > 0 || oldValue.length > 0) {
|
|
180
175
|
for (let y = 0; y < newValue.length; y++) {
|
|
181
176
|
const arrayPath = path.concat(y);
|
|
@@ -187,6 +182,11 @@ function JsonDiffFactory() {
|
|
|
187
182
|
}
|
|
188
183
|
else
|
|
189
184
|
allChildrenChanged = false;
|
|
185
|
+
if (newValue.length !== oldValue.length)
|
|
186
|
+
resp.push({
|
|
187
|
+
path: path.concat("length"),
|
|
188
|
+
value: newValue.length,
|
|
189
|
+
});
|
|
190
190
|
return allChildrenChanged;
|
|
191
191
|
}
|
|
192
192
|
/**
|