reactronic 0.21.604 → 0.22.101

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/README.md CHANGED
@@ -196,7 +196,7 @@ class Component<P> extends React.Component<P> {
196
196
  @reaction // called immediately in response to changes
197
197
  ensureUpToDate(): void {
198
198
  if (this.shouldComponentUpdate())
199
- standalone(() => this.setState({})) // ask React to re-render
199
+ nontransactional(() => this.setState({})) // ask React to re-render
200
200
  } // ensureUpToDate is subscribed to render
201
201
 
202
202
  shouldComponentUpdate(): boolean {
@@ -208,7 +208,7 @@ class Component<P> extends React.Component<P> {
208
208
  }
209
209
 
210
210
  componentWillUnmount(): void {
211
- standalone(Rx.dispose, this)
211
+ Transaction.runAs({ standalone: true }, Rx.dispose, this)
212
212
  }
213
213
  }
214
214
  ```
@@ -310,7 +310,7 @@ function monitor(value: Monitor | null)
310
310
  function trace(value: Partial<TraceOptions>)
311
311
 
312
312
  function nonreactive<T>(func: F<T>, ...args: any[]): T
313
- function standalone<T>(func: F<T>, ...args: any[]): T
313
+ function nontransactional<T>(func: F<T>, ...args: any[]): T
314
314
  function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
315
315
 
316
316
  // Options, ObjectOptions, Kind, Reentrance, Monitor, TraceOptions, ProfilingOptions
@@ -421,7 +421,7 @@ class Transaction implements Worker {
421
421
  static run<T>(hint: string, func: F<T>, ...args: any[]): T
422
422
  static runEx<T>(hint: string, standalone: boolean, sidebyside: boolean,
423
423
  trace: Partial<TraceOptions | undefined>, func: F<T>, ...args: any[]): T
424
- static standalone<T>(func: F<T>, ...args: any[]): T
424
+ static nontransactional<T>(func: F<T>, ...args: any[]): T
425
425
  }
426
426
 
427
427
  // Controller
@@ -18,7 +18,7 @@ export declare class Rx {
18
18
  static setProfilingMode(enabled: boolean, options?: Partial<ProfilingOptions>): void;
19
19
  }
20
20
  export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
21
- export declare function standalone<T>(func: F<T>, ...args: any[]): T;
21
+ export declare function nontransactional<T>(func: F<T>, ...args: any[]): T;
22
22
  export declare function sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
23
23
  export declare function unobservable(proto: object, prop: PropertyKey): any;
24
24
  export declare function transaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Rx = void 0;
3
+ exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.nontransactional = exports.nonreactive = exports.Rx = void 0;
4
4
  const Dbg_1 = require("./util/Dbg");
5
5
  const Options_1 = require("./Options");
6
6
  const Data_1 = require("./impl/Data");
@@ -29,10 +29,10 @@ function nonreactive(func, ...args) {
29
29
  return Operation_1.OperationController.runWithin(undefined, func, ...args);
30
30
  }
31
31
  exports.nonreactive = nonreactive;
32
- function standalone(func, ...args) {
33
- return Operation_1.OperationController.runWithin(undefined, Transaction_1.Transaction.standalone, func, ...args);
32
+ function nontransactional(func, ...args) {
33
+ return Operation_1.OperationController.runWithin(undefined, Transaction_1.Transaction.nontransactional, func, ...args);
34
34
  }
35
- exports.standalone = standalone;
35
+ exports.nontransactional = nontransactional;
36
36
  function sensitive(sensitivity, func, ...args) {
37
37
  return Hooks_1.Hooks.sensitive(sensitivity, func, ...args);
38
38
  }
@@ -11,4 +11,4 @@ export { Snapshot } from './impl/Snapshot';
11
11
  export { Transaction } from './impl/Transaction';
12
12
  export { Monitor } from './impl/Monitor';
13
13
  export { TransactionJournal } from './impl/TransactionJournal';
14
- export { Rx, nonreactive, standalone, sensitive, unobservable, transaction, reaction, cached, options } from './Rx';
14
+ export { Rx, nonreactive, nontransactional, sensitive, unobservable, transaction, reaction, cached, options } from './Rx';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Rx = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.TraceLevel = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.pause = exports.all = void 0;
3
+ exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.nontransactional = exports.nonreactive = exports.Rx = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.TraceLevel = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.pause = exports.all = void 0;
4
4
  var Utils_1 = require("./util/Utils");
5
5
  Object.defineProperty(exports, "all", { enumerable: true, get: function () { return Utils_1.all; } });
6
6
  Object.defineProperty(exports, "pause", { enumerable: true, get: function () { return Utils_1.pause; } });
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "TransactionJournal", { enumerable: true, get: fu
32
32
  var Rx_1 = require("./Rx");
33
33
  Object.defineProperty(exports, "Rx", { enumerable: true, get: function () { return Rx_1.Rx; } });
34
34
  Object.defineProperty(exports, "nonreactive", { enumerable: true, get: function () { return Rx_1.nonreactive; } });
35
- Object.defineProperty(exports, "standalone", { enumerable: true, get: function () { return Rx_1.standalone; } });
35
+ Object.defineProperty(exports, "nontransactional", { enumerable: true, get: function () { return Rx_1.nontransactional; } });
36
36
  Object.defineProperty(exports, "sensitive", { enumerable: true, get: function () { return Rx_1.sensitive; } });
37
37
  Object.defineProperty(exports, "unobservable", { enumerable: true, get: function () { return Rx_1.unobservable; } });
38
38
  Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return Rx_1.transaction; } });
@@ -418,7 +418,7 @@ class Operation extends Data_1.Observable {
418
418
  OperationController.runWithin(undefined, Transaction_1.Transaction.runAs, options, Monitor_1.MonitorImpl.enter, mon, this.transaction);
419
419
  }
420
420
  monitorLeave(mon) {
421
- Transaction_1.Transaction.standalone(() => {
421
+ Transaction_1.Transaction.nontransactional(() => {
422
422
  const leave = () => {
423
423
  const options = {
424
424
  hint: 'Monitor.leave',
@@ -444,7 +444,8 @@ class Operation extends Data_1.Observable {
444
444
  static markUsed(observable, r, m, h, kind, weak) {
445
445
  if (kind !== Options_1.Kind.Transaction) {
446
446
  const op = Operation.current;
447
- if (op && op.options.kind !== Options_1.Kind.Transaction && m !== Data_1.Meta.Holder) {
447
+ if (op && op.options.kind !== Options_1.Kind.Transaction &&
448
+ op.transaction === Transaction_1.Transaction.current && m !== Data_1.Meta.Holder) {
448
449
  const ctx = Snapshot_1.Snapshot.current();
449
450
  if (ctx !== r.snapshot)
450
451
  ctx.bumpBy(r.snapshot.timestamp);
@@ -23,7 +23,7 @@ export declare abstract class Transaction implements Worker {
23
23
  static create(options: SnapshotOptions | null): Transaction;
24
24
  static run<T>(func: F<T>, ...args: any[]): T;
25
25
  static runAs<T>(options: SnapshotOptions | null, func: F<T>, ...args: any[]): T;
26
- static standalone<T>(func: F<T>, ...args: any[]): T;
26
+ static nontransactional<T>(func: F<T>, ...args: any[]): T;
27
27
  static isFrameOver(everyN?: number, timeLimit?: number): boolean;
28
28
  static requestNextFrame(sleepTime?: number): Promise<void>;
29
29
  static get isCanceled(): boolean;
@@ -21,7 +21,7 @@ class Transaction {
21
21
  static create(options) { return new TransactionImpl(options); }
22
22
  static run(func, ...args) { return TransactionImpl.run(func, ...args); }
23
23
  static runAs(options, func, ...args) { return TransactionImpl.runAs(options, func, ...args); }
24
- static standalone(func, ...args) { return TransactionImpl.standalone(func, ...args); }
24
+ static nontransactional(func, ...args) { return TransactionImpl.nontransactional(func, ...args); }
25
25
  static isFrameOver(everyN = 1, timeLimit = 14) { return TransactionImpl.isFrameOver(everyN, timeLimit); }
26
26
  static requestNextFrame(sleepTime = 0) { return TransactionImpl.requestNextFrame(sleepTime); }
27
27
  static get isCanceled() { return TransactionImpl.current.isCanceled; }
@@ -125,7 +125,7 @@ class TransactionImpl extends Transaction {
125
125
  let result = t.runImpl(options === null || options === void 0 ? void 0 : options.trace, func, ...args);
126
126
  if (root) {
127
127
  if (result instanceof Promise) {
128
- result = TransactionImpl.standalone(() => {
128
+ result = TransactionImpl.nontransactional(() => {
129
129
  return t.wrapToRetry(t.wrapToWaitUntilFinish(result), func, ...args);
130
130
  });
131
131
  }
@@ -133,7 +133,7 @@ class TransactionImpl extends Transaction {
133
133
  }
134
134
  return result;
135
135
  }
136
- static standalone(func, ...args) {
136
+ static nontransactional(func, ...args) {
137
137
  const outer = TransactionImpl.curr;
138
138
  try {
139
139
  TransactionImpl.curr = TransactionImpl.none;
@@ -230,7 +230,7 @@ class TransactionImpl extends Transaction {
230
230
  if (this.sealed && this.pending === 0) {
231
231
  const reactions = this.applyOrDiscard();
232
232
  TransactionImpl.curr = outer;
233
- TransactionImpl.standalone(Snapshot_1.Snapshot.enqueueReactionsToRun, reactions);
233
+ TransactionImpl.nontransactional(Snapshot_1.Snapshot.enqueueReactionsToRun, reactions);
234
234
  }
235
235
  else
236
236
  TransactionImpl.curr = outer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.21.604",
3
+ "version": "0.22.101",
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",