reactronic 0.21.514 → 0.21.515
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/build/dist/source/Options.d.ts +0 -5
- package/build/dist/source/Options.js +1 -7
- package/build/dist/source/Reactronic.d.ts +2 -2
- package/build/dist/source/api.d.ts +1 -1
- package/build/dist/source/api.js +1 -2
- package/build/dist/source/impl/Hooks.d.ts +3 -3
- package/build/dist/source/impl/Hooks.js +8 -16
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Reentrance = exports.Kind = exports.TraceLevel = void 0;
|
|
4
4
|
var Trace_1 = require("./Trace");
|
|
5
5
|
Object.defineProperty(exports, "TraceLevel", { enumerable: true, get: function () { return Trace_1.TraceLevel; } });
|
|
6
6
|
var Kind;
|
|
@@ -19,9 +19,3 @@ var Reentrance;
|
|
|
19
19
|
Reentrance[Reentrance["OverwritePrevious"] = -3] = "OverwritePrevious";
|
|
20
20
|
Reentrance[Reentrance["RunSideBySide"] = -4] = "RunSideBySide";
|
|
21
21
|
})(Reentrance = exports.Reentrance || (exports.Reentrance = {}));
|
|
22
|
-
var Sensitivity;
|
|
23
|
-
(function (Sensitivity) {
|
|
24
|
-
Sensitivity[Sensitivity["ReactOnFinalDifferenceOnly"] = 0] = "ReactOnFinalDifferenceOnly";
|
|
25
|
-
Sensitivity[Sensitivity["ReactOnFinalAndIntermediateDifference"] = 1] = "ReactOnFinalAndIntermediateDifference";
|
|
26
|
-
Sensitivity[Sensitivity["ReactEvenOnSameValueAssignment"] = 2] = "ReactEvenOnSameValueAssignment";
|
|
27
|
-
})(Sensitivity = exports.Sensitivity || (exports.Sensitivity = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F } from './util/Utils';
|
|
2
2
|
import { Controller } from './Controller';
|
|
3
|
-
import { MemberOptions, TraceOptions, ProfilingOptions
|
|
3
|
+
import { MemberOptions, TraceOptions, ProfilingOptions } from './Options';
|
|
4
4
|
export declare class Reactronic {
|
|
5
5
|
static why(brief?: boolean): string;
|
|
6
6
|
static getController<T>(method: F<T>): Controller<T>;
|
|
@@ -19,7 +19,7 @@ export declare class Reactronic {
|
|
|
19
19
|
}
|
|
20
20
|
export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
|
|
21
21
|
export declare function standalone<T>(func: F<T>, ...args: any[]): T;
|
|
22
|
-
export declare function sensitive<T>(sensitivity:
|
|
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;
|
|
25
25
|
export declare function reaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
|
|
@@ -2,7 +2,7 @@ export { all, sleep } 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,
|
|
5
|
+
export { MemberOptions, 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';
|
package/build/dist/source/api.js
CHANGED
|
@@ -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.Reactronic = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.TraceLevel = exports.
|
|
3
|
+
exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Reactronic = 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.sleep = 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, "sleep", { enumerable: true, get: function () { return Utils_1.sleep; } });
|
|
@@ -13,7 +13,6 @@ Object.defineProperty(exports, "SealedSet", { enumerable: true, get: function ()
|
|
|
13
13
|
var Options_1 = require("./Options");
|
|
14
14
|
Object.defineProperty(exports, "Kind", { enumerable: true, get: function () { return Options_1.Kind; } });
|
|
15
15
|
Object.defineProperty(exports, "Reentrance", { enumerable: true, get: function () { return Options_1.Reentrance; } });
|
|
16
|
-
Object.defineProperty(exports, "Sensitivity", { enumerable: true, get: function () { return Options_1.Sensitivity; } });
|
|
17
16
|
Object.defineProperty(exports, "TraceLevel", { enumerable: true, get: function () { return Options_1.TraceLevel; } });
|
|
18
17
|
var Controller_1 = require("./Controller");
|
|
19
18
|
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F } from '../util/Utils';
|
|
2
|
-
import { MemberOptions, Kind, Reentrance
|
|
2
|
+
import { MemberOptions, Kind, Reentrance } from '../Options';
|
|
3
3
|
import { TraceOptions, ProfilingOptions } from '../Trace';
|
|
4
4
|
import { MemberName, ObjectHolder } from './Data';
|
|
5
5
|
import { TransactionJournal } from './TransactionJournal';
|
|
@@ -28,7 +28,7 @@ export declare class Hooks implements ProxyHandler<ObjectHolder> {
|
|
|
28
28
|
static repetitiveUsageWarningThreshold: number;
|
|
29
29
|
static mainThreadBlockingWarningThreshold: number;
|
|
30
30
|
static asyncActionDurationWarningThreshold: number;
|
|
31
|
-
static sensitivity:
|
|
31
|
+
static sensitivity: boolean;
|
|
32
32
|
static readonly proxy: Hooks;
|
|
33
33
|
getPrototypeOf(h: ObjectHolder): object | null;
|
|
34
34
|
get(h: ObjectHolder, m: MemberName, receiver: any): any;
|
|
@@ -42,7 +42,7 @@ export declare class Hooks implements ProxyHandler<ObjectHolder> {
|
|
|
42
42
|
static acquireObjectHolder(obj: any): ObjectHolder;
|
|
43
43
|
static createObjectHolder(unobservable: any, blank: any, hint: string): ObjectHolder;
|
|
44
44
|
static setProfilingMode(enabled: boolean, options?: Partial<ProfilingOptions>): void;
|
|
45
|
-
static sensitive<T>(sensitivity:
|
|
45
|
+
static sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
|
|
46
46
|
static setHint<T>(obj: T, hint: string | undefined): T;
|
|
47
47
|
static createControllerAndGetHook: (h: ObjectHolder, m: MemberName, options: OptionsImpl) => F<any>;
|
|
48
48
|
static rememberOperationOptions: (proto: any, m: MemberName, getter: Function | undefined, setter: Function | undefined, enumerable: boolean, configurable: boolean, options: Partial<MemberOptions>, implicit: boolean) => OptionsImpl;
|
|
@@ -78,24 +78,16 @@ class Hooks {
|
|
|
78
78
|
set(h, m, value, receiver) {
|
|
79
79
|
const r = Snapshot_1.Snapshot.edit().getEditableRevision(h, m, value);
|
|
80
80
|
if (r !== Snapshot_1.ROOT_REV) {
|
|
81
|
-
|
|
81
|
+
let curr = r.data[m];
|
|
82
82
|
if (curr !== undefined || (r.prev.revision.snapshot === Snapshot_1.ROOT_REV.snapshot && m in h.unobservable === false)) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (edited) {
|
|
87
|
-
if (prev === curr)
|
|
88
|
-
r.data[m] = new Data_1.Observable(value);
|
|
89
|
-
else
|
|
90
|
-
curr.value = value;
|
|
83
|
+
if (curr === undefined || r.prev.revision.data[m] === curr) {
|
|
84
|
+
curr = r.data[m] = new Data_1.Observable(value);
|
|
85
|
+
Snapshot_1.Snapshot.markEdited(value, true, r, m, h);
|
|
91
86
|
}
|
|
92
|
-
else if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
else
|
|
96
|
-
edited = true;
|
|
87
|
+
else if (curr.value !== value || Hooks.sensitivity) {
|
|
88
|
+
curr.value = value;
|
|
89
|
+
Snapshot_1.Snapshot.markEdited(value, true, r, m, h);
|
|
97
90
|
}
|
|
98
|
-
Snapshot_1.Snapshot.markEdited(value, edited, r, m, h);
|
|
99
91
|
}
|
|
100
92
|
else
|
|
101
93
|
Reflect.set(h.unobservable, m, value, receiver);
|
|
@@ -233,7 +225,7 @@ Hooks.reactionsAutoStartDisabled = false;
|
|
|
233
225
|
Hooks.repetitiveUsageWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
234
226
|
Hooks.mainThreadBlockingWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
235
227
|
Hooks.asyncActionDurationWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
236
|
-
Hooks.sensitivity =
|
|
228
|
+
Hooks.sensitivity = false;
|
|
237
229
|
Hooks.proxy = new Hooks();
|
|
238
230
|
Hooks.createControllerAndGetHook = function (h, m, options) {
|
|
239
231
|
throw (0, Dbg_1.misuse)('createControllerAndGetHook should never be called');
|