@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.js
CHANGED
|
@@ -302,10 +302,16 @@ class Subscriber {
|
|
|
302
302
|
if (!this.active || !using.has(key))
|
|
303
303
|
return;
|
|
304
304
|
const handler = using.get(key);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
305
|
+
let notify;
|
|
306
|
+
if (typeof handler == "function") {
|
|
307
|
+
const callback = handler();
|
|
308
|
+
if (typeof callback == "function")
|
|
309
|
+
notify = callback;
|
|
310
|
+
else if (callback === true)
|
|
311
|
+
notify = this.onUpdate(key, parent);
|
|
312
|
+
}
|
|
313
|
+
else
|
|
314
|
+
notify = this.onUpdate(key, parent);
|
|
309
315
|
const getWhy = () => {
|
|
310
316
|
const update = getUpdate(parent.subject);
|
|
311
317
|
const applicable = update.filter(k => using.has(k));
|
|
@@ -1012,20 +1018,25 @@ function managedMap(control, property, initial) {
|
|
|
1012
1018
|
return managed;
|
|
1013
1019
|
if (context.has(local))
|
|
1014
1020
|
return context.get(local);
|
|
1021
|
+
const refresh = local.onUpdate(property, control);
|
|
1015
1022
|
const proxy = Object.create(managed);
|
|
1016
1023
|
const using = new Set();
|
|
1024
|
+
const update = () => {
|
|
1025
|
+
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
1026
|
+
refresh();
|
|
1027
|
+
else
|
|
1028
|
+
for (const key of lastUpdate)
|
|
1029
|
+
if (using.has(key)) {
|
|
1030
|
+
refresh();
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1017
1034
|
context.set(local, proxy);
|
|
1018
1035
|
assoc.set(proxy, (key) => {
|
|
1019
1036
|
if (!local.active)
|
|
1020
1037
|
using.add(key);
|
|
1021
1038
|
});
|
|
1022
|
-
local.add(property, () =>
|
|
1023
|
-
if (using.has(ANY$1) || lastUpdate.has(ANY$1) && using.size)
|
|
1024
|
-
return true;
|
|
1025
|
-
for (const key of lastUpdate)
|
|
1026
|
-
if (using.has(key))
|
|
1027
|
-
return true;
|
|
1028
|
-
});
|
|
1039
|
+
local.add(property, () => update);
|
|
1029
1040
|
return proxy;
|
|
1030
1041
|
}
|
|
1031
1042
|
setValue(initial, true);
|
|
@@ -1105,20 +1116,25 @@ function managedSet(control, property, initial) {
|
|
|
1105
1116
|
return managed;
|
|
1106
1117
|
if (context.has(local))
|
|
1107
1118
|
return context.get(local);
|
|
1119
|
+
const refresh = local.onUpdate(property, control);
|
|
1108
1120
|
const proxy = Object.create(managed);
|
|
1109
1121
|
const using = new Set();
|
|
1122
|
+
const update = () => {
|
|
1123
|
+
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
1124
|
+
refresh();
|
|
1125
|
+
else
|
|
1126
|
+
for (const key of lastUpdate)
|
|
1127
|
+
if (using.has(key)) {
|
|
1128
|
+
refresh();
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1110
1132
|
context.set(local, proxy);
|
|
1111
1133
|
assoc.set(proxy, (key) => {
|
|
1112
1134
|
if (!local.active)
|
|
1113
1135
|
using.add(key);
|
|
1114
1136
|
});
|
|
1115
|
-
local.add(property, () =>
|
|
1116
|
-
if (using.has(ANY) || lastUpdate.has(ANY) && using.size)
|
|
1117
|
-
return true;
|
|
1118
|
-
for (const key of lastUpdate)
|
|
1119
|
-
if (using.has(key))
|
|
1120
|
-
return true;
|
|
1121
|
-
});
|
|
1137
|
+
local.add(property, () => update);
|
|
1122
1138
|
return proxy;
|
|
1123
1139
|
}
|
|
1124
1140
|
setValue(initial, true);
|