reactronic 0.22.105 → 0.22.109

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (C) 2016-2021 Yury Chetyrko <ychetyrko@gmail.com>
3
+ Copyright (C) 2016-2022 Yury Chetyrko <ychetyrko@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@ export { all, pause } from './util/Utils';
2
2
  export { SealedArray } from './util/SealedArray';
3
3
  export { SealedMap } from './util/SealedMap';
4
4
  export { SealedSet } from './util/SealedSet';
5
- export { MemberOptions, Kind, Reentrance, TraceOptions, ProfilingOptions, TraceLevel } from './Options';
5
+ export { MemberOptions, SnapshotOptions, Kind, Reentrance, TraceOptions, ProfilingOptions, TraceLevel } from './Options';
6
6
  export { Worker } from './Worker';
7
7
  export { Controller } from './Controller';
8
8
  export { Ref, ToggleRef, BoolOnly, GivenTypeOnly } from './Ref';
@@ -12,7 +12,7 @@ export declare class Observable {
12
12
  get originSnapshotId(): number | undefined;
13
13
  constructor(value: any);
14
14
  }
15
- export declare type StandaloneMode = boolean | 'isolated';
15
+ export declare type StandaloneMode = boolean | 'isolated' | 'disposal';
16
16
  export interface Observer {
17
17
  readonly order: number;
18
18
  readonly observables: Map<Observable, ObservableInfo> | undefined;
@@ -39,7 +39,7 @@ export declare class Snapshot implements AbstractSnapshot {
39
39
  acquire(outer: Snapshot): void;
40
40
  bumpBy(timestamp: number): void;
41
41
  rebase(): ObjectRevision[] | undefined;
42
- private static merge;
42
+ private merge;
43
43
  applyOrDiscard(error?: any): Array<Observer>;
44
44
  static sealObjectRevision(h: ObjectHolder, r: ObjectRevision): void;
45
45
  static sealObservable(observable: Observable | symbol, m: MemberName, typeName: string): void;
@@ -130,7 +130,7 @@ class Snapshot {
130
130
  if (this.changeset.size > 0) {
131
131
  this.changeset.forEach((r, h) => {
132
132
  if (r.prev.revision !== h.head) {
133
- const merged = Snapshot.merge(h, r);
133
+ const merged = this.merge(h, r);
134
134
  if (r.conflicts.size > 0) {
135
135
  if (!conflicts)
136
136
  conflicts = [];
@@ -154,19 +154,21 @@ class Snapshot {
154
154
  }
155
155
  return conflicts;
156
156
  }
157
- static merge(h, ours) {
157
+ merge(h, ours) {
158
158
  let counter = 0;
159
159
  const head = h.head;
160
- const disposed = head.changes.has(Data_1.Meta.Disposed);
160
+ const headDisposed = head.changes.has(Data_1.Meta.Disposed);
161
161
  const merged = Object.assign({}, head.data);
162
162
  ours.changes.forEach((o, m) => {
163
163
  counter++;
164
164
  merged[m] = ours.data[m];
165
- if (disposed || m === Data_1.Meta.Disposed) {
166
- if (disposed !== (m === Data_1.Meta.Disposed)) {
167
- if (Dbg_1.Dbg.isOn && Dbg_1.Dbg.trace.change)
168
- Dbg_1.Dbg.log('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} <> ${Dump.rev2(h, head.snapshot, m)}`, 0, ' *** CONFLICT ***');
169
- ours.conflicts.set(m, head);
165
+ if (headDisposed || m === Data_1.Meta.Disposed) {
166
+ if (headDisposed !== (m === Data_1.Meta.Disposed)) {
167
+ if (headDisposed || this.options.standalone !== 'disposal') {
168
+ if (Dbg_1.Dbg.isOn && Dbg_1.Dbg.trace.change)
169
+ Dbg_1.Dbg.log('║╠', '', `${Dump.rev2(h, ours.snapshot, m)} <> ${Dump.rev2(h, head.snapshot, m)}`, 0, ' *** CONFLICT ***');
170
+ ours.conflicts.set(m, head);
171
+ }
170
172
  }
171
173
  }
172
174
  else {
@@ -22,7 +22,7 @@ class Transaction {
22
22
  static run(options, func, ...args) { return TransactionImpl.run(options, func, ...args); }
23
23
  static standalone(func, ...args) { return TransactionImpl.standalone(func, ...args); }
24
24
  static off(func, ...args) { return TransactionImpl.off(func, ...args); }
25
- static isFrameOver(everyN = 1, timeLimit = 14) { return TransactionImpl.isFrameOver(everyN, timeLimit); }
25
+ static isFrameOver(everyN = 1, timeLimit = 10) { return TransactionImpl.isFrameOver(everyN, timeLimit); }
26
26
  static requestNextFrame(sleepTime = 0) { return TransactionImpl.requestNextFrame(sleepTime); }
27
27
  static get isCanceled() { return TransactionImpl.current.isCanceled; }
28
28
  }
@@ -143,7 +143,7 @@ class TransactionImpl extends Transaction {
143
143
  TransactionImpl.curr = outer;
144
144
  }
145
145
  }
146
- static isFrameOver(everyN = 1, timeLimit = 14) {
146
+ static isFrameOver(everyN = 1, timeLimit = 10) {
147
147
  TransactionImpl.frameOverCounter++;
148
148
  let result = TransactionImpl.frameOverCounter % everyN === 0;
149
149
  if (result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.22.105",
3
+ "version": "0.22.109",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "main": "build/dist/source/api.js",
6
6
  "types": "build/dist/source/api.d.ts",