@jbrowse/mobx-state-tree 6.1.0 → 6.2.0

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
@@ -604,7 +604,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
604
604
  applySnapshot(snapshot: C): void;
605
605
  private _autoUnbox;
606
606
  _isRunningAction: boolean;
607
- private _hasSnapshotReaction;
607
+ private _snapshotReactionDisposer?;
608
608
  private _observableInstanceState;
609
609
  private _childNodes;
610
610
  private _initialSnapshot;
@@ -663,6 +663,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
663
663
  addMiddleWare(handler: IMiddlewareHandler, includeHooks?: boolean): IDisposer;
664
664
  applyPatchLocally(subpath: string, patch: IJsonPatch): void;
665
665
  private _addSnapshotReaction;
666
+ private _removeSnapshotReaction;
666
667
  private _internalEvents?;
667
668
  private _internalEventsHasSubscribers;
668
669
  private _internalEventsRegister;
@@ -913,14 +914,36 @@ type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
913
914
  * @hidden
914
915
  */
915
916
  declare abstract class BaseType<C, S, T, N extends BaseNode<any, any, any> = BaseNode<C, S, T>> implements IType<C, S, T> {
916
- [$type]: undefined;
917
+ readonly [$type]: undefined;
917
918
  readonly C: C;
918
919
  readonly S: S;
919
920
  readonly T: T;
920
921
  readonly N: N;
921
- readonly isType = true;
922
- readonly name: string;
923
- constructor(name: string);
922
+ readonly isType: true;
923
+ private _name?;
924
+ /**
925
+ * Builds the name of a type that does not get one handed to it. Composite
926
+ * types (`union`, `array`, `map`, `reference`, ...) override this to fold
927
+ * their members' names; see {@link name}. It runs after construction, so
928
+ * unlike a `super(...)` argument it can read the subclass's own fields.
929
+ */
930
+ protected computeName(): string;
931
+ /**
932
+ * Friendly type name.
933
+ *
934
+ * A composite type folds its members' names, which for a union is a map +
935
+ * join over every member — and the result is read only by error messages and
936
+ * `describe()`. So those types leave it unset and it is built on first read
937
+ * and cached: a union that never fails a typecheck never builds one, and
938
+ * jbrowse builds a union per config slot, tens of thousands per session load.
939
+ *
940
+ * Deliberately not a lambda passed to the constructor: that allocated a
941
+ * closure per type (the very cost being avoided) and made two separately
942
+ * built but equivalent types compare unequal, since the closures differ.
943
+ */
944
+ get name(): string;
945
+ set name(value: string);
946
+ constructor(name?: string);
924
947
  create(snapshot?: C, environment?: any): any;
925
948
  getSnapshot(_node: N, _applyPostProcess?: boolean): S;
926
949
  abstract reconcile(current: N, newValue: C | T, parent: AnyObjectNode, subpath: string): N;