@expressive/mvc 1.0.0-beta.38 → 1.0.0-beta.40

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 CHANGED
@@ -445,8 +445,15 @@ declare class MVC extends Model {
445
445
  static new<T extends Class>(this: T, callback?: (instance: InstanceOf<T>) => void): InstanceOf<T>;
446
446
  static use<T extends Class, I extends InstanceOf<T>>(this: T, watch: Model.Field<I>[], callback?: (instance: I) => void): I;
447
447
  static use<T extends Class, I extends InstanceOf<T>>(this: T, callback?: (instance: I) => void): I;
448
- static uses<T extends typeof MVC, I extends InstanceOf<T>, D extends Partial<I>>(this: T, data: D, only?: (keyof D & string)[]): InstanceOf<T>;
449
- static using<T extends typeof MVC, I extends InstanceOf<T>, D extends Partial<I>>(this: T, data: D, only?: (keyof D & string)[]): InstanceOf<T>;
448
+ static use<T extends Class, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>, keys?: Model.Event<I>[]): I;
449
+ /**
450
+ * @deprecated consider doing this manually - not worth minor efficiency gain over using.
451
+ */
452
+ static uses<T extends typeof MVC, I extends InstanceOf<T>, D extends Model.Compat<I>>(this: T, apply: D, keys?: (keyof D)[]): InstanceOf<T>;
453
+ /**
454
+ * @deprecated is now replaced by overload of `use` method.
455
+ */
456
+ static using<T extends typeof MVC, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>, keys?: Model.Event<I>[]): I;
450
457
  static meta<T extends Class>(this: T): T;
451
458
  static meta<T extends Class, K extends keyof T>(this: T, key: K, expect: true): Exclude<T[K], undefined>;
452
459
  static meta<T extends Class, K extends keyof T>(this: T, key: K, expect?: boolean): T[K];
package/lib/index.esm.js CHANGED
@@ -1130,20 +1130,24 @@ class MVC extends Model {
1130
1130
  static new(callback) {
1131
1131
  return useModel(this, [], callback);
1132
1132
  }
1133
- static use(arg, callback) {
1134
- const instance = useModel(this, arg, callback);
1133
+ static use(a, b) {
1134
+ const instance = useModel(this, a, b);
1135
1135
  usePeerContext(instance.get);
1136
1136
  return instance;
1137
1137
  }
1138
- static uses(data, only) {
1138
+ /**
1139
+ * @deprecated consider doing this manually - not worth minor efficiency gain over using.
1140
+ */
1141
+ static uses(apply, keys) {
1139
1142
  return this.use(instance => {
1140
- instance.import(data, only);
1143
+ instance.import(apply, keys);
1141
1144
  });
1142
1145
  }
1143
- static using(data, only) {
1144
- const instance = this.use();
1145
- instance.import(data, only);
1146
- return instance;
1146
+ /**
1147
+ * @deprecated is now replaced by overload of `use` method.
1148
+ */
1149
+ static using(apply, keys) {
1150
+ return this.use(apply, keys);
1147
1151
  }
1148
1152
  static meta(path, expect) {
1149
1153
  return useTap(() => this, path, expect);