@expressive/mvc 1.0.0-beta.13 → 1.0.0-beta.14

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
@@ -1058,10 +1058,11 @@ class Singleton extends Model {
1058
1058
  instance.import(updates);
1059
1059
  return instance.update();
1060
1060
  }
1061
- static find() {
1062
- if (this.current)
1063
- return this.current;
1064
- throw Oops.GlobalDoesNotExist(this.name);
1061
+ static find(strict) {
1062
+ const instance = this.current;
1063
+ if (!instance && strict)
1064
+ throw Oops.GlobalDoesNotExist(this.name);
1065
+ return instance;
1065
1066
  }
1066
1067
  static reset() {
1067
1068
  if (this.current)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressive/mvc",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.14",
4
4
  "description": "Use classes to define state in React!",
5
5
  "author": {
6
6
  "name": "Gabe Klein",
package/types/model.d.ts CHANGED
@@ -338,7 +338,8 @@ export abstract class State {
338
338
  /**
339
339
  * **React Hook** - Locate most relevant instance of this type in context.
340
340
  */
341
- static find <T extends Class>(this: T): InstanceOf<T>;
341
+ static find <T extends Class>(this: T, strict: true): InstanceOf<T>;
342
+ static find <T extends Class>(this: T, strict?: boolean): InstanceOf<T> | undefined;
342
343
 
343
344
  /**
344
345
  * **React Hook** - Fetch most instance of this controller from context, if it exists.
@@ -475,9 +476,6 @@ export abstract class Model extends State {
475
476
  }
476
477
 
477
478
  export class Singleton extends Model {
478
- /** Current instance of this controller accessable anywhere. */
479
- static current?: Singleton;
480
-
481
479
  /**
482
480
  * Update the active instance of this class.
483
481
  * Returns a thenable; resolves after successful update.