@expressive/mvc 1.0.0-beta.40 → 1.0.0-beta.41
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 -1
- package/lib/index.esm.js +13 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +13 -9
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -442,7 +442,8 @@ declare class MVC extends Model {
|
|
|
442
442
|
*
|
|
443
443
|
* @param callback - Run after creation of instance.
|
|
444
444
|
*/
|
|
445
|
-
static new<T extends Class
|
|
445
|
+
static new<T extends Class, I extends InstanceOf<T>>(this: T, callback?: (instance: I) => void): I;
|
|
446
|
+
static new<T extends Class, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>): I;
|
|
446
447
|
static use<T extends Class, I extends InstanceOf<T>>(this: T, watch: Model.Field<I>[], callback?: (instance: I) => void): I;
|
|
447
448
|
static use<T extends Class, I extends InstanceOf<T>>(this: T, callback?: (instance: I) => void): I;
|
|
448
449
|
static use<T extends Class, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>, keys?: Model.Event<I>[]): I;
|
package/lib/index.esm.js
CHANGED
|
@@ -1120,15 +1120,19 @@ class MVC extends Model {
|
|
|
1120
1120
|
static tap(key, expect) {
|
|
1121
1121
|
return useTap(this, key, expect);
|
|
1122
1122
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1123
|
+
static new(arg) {
|
|
1124
|
+
return React.useMemo(() => {
|
|
1125
|
+
const instance = new this();
|
|
1126
|
+
control(instance);
|
|
1127
|
+
if (typeof arg == "function")
|
|
1128
|
+
arg(instance);
|
|
1129
|
+
else if (arg)
|
|
1130
|
+
getOwnPropertyNames(instance).forEach(key => {
|
|
1131
|
+
if (key in arg)
|
|
1132
|
+
instance[key] = arg[key];
|
|
1133
|
+
});
|
|
1134
|
+
return instance;
|
|
1135
|
+
}, []);
|
|
1132
1136
|
}
|
|
1133
1137
|
static use(a, b) {
|
|
1134
1138
|
const instance = useModel(this, a, b);
|