@expressive/mvc 0.4.1 → 0.4.2
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/lib/index.esm.js +34 -18
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +34 -18
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -294,10 +294,16 @@ class Subscriber {
|
|
|
294
294
|
if (!this.active || !using.has(key))
|
|
295
295
|
return;
|
|
296
296
|
const handler = using.get(key);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
let notify;
|
|
298
|
+
if (typeof handler == "function") {
|
|
299
|
+
const callback = handler();
|
|
300
|
+
if (typeof callback == "function")
|
|
301
|
+
notify = callback;
|
|
302
|
+
else if (callback === true)
|
|
303
|
+
notify = this.onUpdate(key, parent);
|
|
304
|
+
}
|
|
305
|
+
else
|
|
306
|
+
notify = this.onUpdate(key, parent);
|
|
301
307
|
const getWhy = () => {
|
|
302
308
|
const update = getUpdate(parent.subject);
|
|
303
309
|
const applicable = update.filter(k => using.has(k));
|
|
@@ -1004,20 +1010,25 @@ function managedMap(control, property, initial) {
|
|
|
1004
1010
|
return managed;
|
|
1005
1011
|
if (context.has(local))
|
|
1006
1012
|
return context.get(local);
|
|
1013
|
+
const refresh = local.onUpdate(property, control);
|
|
1007
1014
|
const proxy = Object.create(managed);
|
|
1008
1015
|
const using = new Set();
|
|
1016
|
+
const update = () => {
|
|
1017
|
+
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
1018
|
+
refresh();
|
|
1019
|
+
else
|
|
1020
|
+
for (const key of lastUpdate)
|
|
1021
|
+
if (using.has(key)) {
|
|
1022
|
+
refresh();
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1009
1026
|
context.set(local, proxy);
|
|
1010
1027
|
assoc.set(proxy, (key) => {
|
|
1011
1028
|
if (!local.active)
|
|
1012
1029
|
using.add(key);
|
|
1013
1030
|
});
|
|
1014
|
-
local.add(property, () =>
|
|
1015
|
-
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
1016
|
-
return true;
|
|
1017
|
-
for (const key of lastUpdate)
|
|
1018
|
-
if (using.has(key))
|
|
1019
|
-
return true;
|
|
1020
|
-
});
|
|
1031
|
+
local.add(property, () => update);
|
|
1021
1032
|
return proxy;
|
|
1022
1033
|
}
|
|
1023
1034
|
setValue(initial, true);
|
|
@@ -1097,20 +1108,25 @@ function managedSet(control, property, initial) {
|
|
|
1097
1108
|
return managed;
|
|
1098
1109
|
if (context.has(local))
|
|
1099
1110
|
return context.get(local);
|
|
1111
|
+
const refresh = local.onUpdate(property, control);
|
|
1100
1112
|
const proxy = Object.create(managed);
|
|
1101
1113
|
const using = new Set();
|
|
1114
|
+
const update = () => {
|
|
1115
|
+
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
1116
|
+
refresh();
|
|
1117
|
+
else
|
|
1118
|
+
for (const key of lastUpdate)
|
|
1119
|
+
if (using.has(key)) {
|
|
1120
|
+
refresh();
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1102
1124
|
context.set(local, proxy);
|
|
1103
1125
|
assoc.set(proxy, (key) => {
|
|
1104
1126
|
if (!local.active)
|
|
1105
1127
|
using.add(key);
|
|
1106
1128
|
});
|
|
1107
|
-
local.add(property, () =>
|
|
1108
|
-
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
1109
|
-
return true;
|
|
1110
|
-
for (const key of lastUpdate)
|
|
1111
|
-
if (using.has(key))
|
|
1112
|
-
return true;
|
|
1113
|
-
});
|
|
1129
|
+
local.add(property, () => update);
|
|
1114
1130
|
return proxy;
|
|
1115
1131
|
}
|
|
1116
1132
|
setValue(initial, true);
|