@expressive/mvc 0.43.1 → 0.43.3

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/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare namespace Model {
7
7
  * Model constructor callback - is called when Model finishes intializing.
8
8
  * Returned function will call when model is destroyed.
9
9
  */
10
- type Callback<T extends Model = Model> = (this: T, thisArg: T) => (() => void) | Assign<T> | void;
10
+ type Callback<T extends Model = Model> = (this: T, thisArg: T) => (() => void) | Assign<T> | Promise<void> | void;
11
11
  /** Model constructor argument */
12
12
  type Argument<T extends Model = Model> = string | Callback<T> | Assign<T> | undefined;
13
13
  /** Subset of `keyof T` which are not methods or defined by base Model U. **/
package/dist/index.js CHANGED
@@ -172,7 +172,12 @@ var Model = class _Model {
172
172
  }
173
173
  addListener(this, () => {
174
174
  const apply = typeof arg == "function" ? arg.call(this, this) : arg;
175
- if (typeof apply == "object")
175
+ if (apply instanceof Promise)
176
+ apply.catch((err) => {
177
+ console.error(`Async error in constructor for ${this}:`);
178
+ console.error(err);
179
+ });
180
+ else if (typeof apply == "object")
176
181
  assign(this, apply);
177
182
  for (const key in this) {
178
183
  const desc = Object.getOwnPropertyDescriptor(this, key);
package/dist/index.mjs CHANGED
@@ -138,7 +138,12 @@ var Model = class _Model {
138
138
  }
139
139
  addListener(this, () => {
140
140
  const apply = typeof arg == "function" ? arg.call(this, this) : arg;
141
- if (typeof apply == "object")
141
+ if (apply instanceof Promise)
142
+ apply.catch((err) => {
143
+ console.error(`Async error in constructor for ${this}:`);
144
+ console.error(err);
145
+ });
146
+ else if (typeof apply == "object")
142
147
  assign(this, apply);
143
148
  for (const key in this) {
144
149
  const desc = Object.getOwnPropertyDescriptor(this, key);
package/package.json CHANGED
@@ -28,6 +28,6 @@
28
28
  "prebuild": "rm -rf dist",
29
29
  "preversion": "npm run test && npm run build"
30
30
  },
31
- "version": "0.43.1",
32
- "gitHead": "1fce74756afb4499f6b4da1c52bfbc2021b73ebb"
31
+ "version": "0.43.3",
32
+ "gitHead": "dfa7549a435a359fb682c34a7e1781c778a29d84"
33
33
  }