@expressive/mvc 0.2.1 → 0.2.4
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 +15 -5
- package/lib/index.esm.js +11 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +10 -5
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1035,9 +1035,14 @@ function useLocal(Type, arg) {
|
|
|
1035
1035
|
const instance = useLookup().get(Type);
|
|
1036
1036
|
if (!instance && arg !== false)
|
|
1037
1037
|
throw Oops$4.NotFound(Type.name);
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1038
|
+
switch (typeof arg) {
|
|
1039
|
+
case "string":
|
|
1040
|
+
return instance[arg];
|
|
1041
|
+
case "function":
|
|
1042
|
+
React.useLayoutEffect(() => arg(instance), []);
|
|
1043
|
+
default:
|
|
1044
|
+
return instance;
|
|
1045
|
+
}
|
|
1041
1046
|
}
|
|
1042
1047
|
|
|
1043
1048
|
const Oops$3 = issues({
|
|
@@ -1233,8 +1238,8 @@ class MVC extends Model {
|
|
|
1233
1238
|
use(arg, callback) {
|
|
1234
1239
|
return useModel(this, arg, callback);
|
|
1235
1240
|
}
|
|
1236
|
-
static get(
|
|
1237
|
-
return useLocal(this,
|
|
1241
|
+
static get(arg) {
|
|
1242
|
+
return useLocal(this, arg);
|
|
1238
1243
|
}
|
|
1239
1244
|
static tap(key, expect) {
|
|
1240
1245
|
return useTap(this, key, expect);
|