@expressive/mvc 0.1.0 → 0.1.1
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.d.ts +2 -2
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1039,7 +1039,7 @@ const useLookup = () => React__default["default"].useContext(LookupContext);
|
|
|
1039
1039
|
const Oops$4 = issues({
|
|
1040
1040
|
NothingInContext: (name) => `Couldn't find ${name} in context; did you forget to use a Provider?`
|
|
1041
1041
|
});
|
|
1042
|
-
function
|
|
1042
|
+
function useLocal(Type, arg) {
|
|
1043
1043
|
const instance = useLookup().get(Type);
|
|
1044
1044
|
if (!instance && arg !== false)
|
|
1045
1045
|
throw Oops$4.NothingInContext(Type.name);
|
|
@@ -1207,7 +1207,7 @@ function useTap(source, path, expect) {
|
|
|
1207
1207
|
if ("get" in source)
|
|
1208
1208
|
return () => source.get();
|
|
1209
1209
|
if ("prototype" in source)
|
|
1210
|
-
return () =>
|
|
1210
|
+
return () => useLocal(source);
|
|
1211
1211
|
else
|
|
1212
1212
|
return source;
|
|
1213
1213
|
}, [])();
|
|
@@ -1242,7 +1242,7 @@ class MVC extends Model {
|
|
|
1242
1242
|
return useModel(this, arg, callback);
|
|
1243
1243
|
}
|
|
1244
1244
|
static get(required) {
|
|
1245
|
-
return
|
|
1245
|
+
return useLocal(this, required);
|
|
1246
1246
|
}
|
|
1247
1247
|
static tap(key, expect) {
|
|
1248
1248
|
return useTap(this, key, expect);
|
|
@@ -1296,7 +1296,7 @@ function Consumer(props) {
|
|
|
1296
1296
|
return children(useTap(Control));
|
|
1297
1297
|
const callback = has || get;
|
|
1298
1298
|
if (typeof callback == "function")
|
|
1299
|
-
callback(
|
|
1299
|
+
callback(useLocal(Control, !!has));
|
|
1300
1300
|
else
|
|
1301
1301
|
throw Oops$2.BadConsumerProps();
|
|
1302
1302
|
return null;
|
|
@@ -1415,7 +1415,7 @@ exports.set = set;
|
|
|
1415
1415
|
exports.tap = tap;
|
|
1416
1416
|
exports.use = use$1;
|
|
1417
1417
|
exports.useFrom = useFrom;
|
|
1418
|
-
exports.
|
|
1418
|
+
exports.useLocal = useLocal;
|
|
1419
1419
|
exports.useModel = useModel;
|
|
1420
1420
|
exports.useTap = useTap;
|
|
1421
1421
|
//# sourceMappingURL=index.js.map
|