@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.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
- return typeof arg == "string" ?
1039
- instance[arg] :
1040
- instance;
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(required) {
1237
- return useLocal(this, required);
1241
+ static get(arg) {
1242
+ return useLocal(this, arg);
1238
1243
  }
1239
1244
  static tap(key, expect) {
1240
1245
  return useTap(this, key, expect);