reactronic 0.22.109 → 0.22.202
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 +18 -27
- package/build/dist/source/{Trace.d.ts → Logging.d.ts} +9 -9
- package/build/dist/source/{Trace.js → Logging.js} +25 -25
- package/build/dist/source/Options.d.ts +5 -5
- package/build/dist/source/Options.js +3 -3
- package/build/dist/source/Rx.d.ts +7 -7
- package/build/dist/source/Rx.js +6 -6
- package/build/dist/source/api.d.ts +1 -1
- package/build/dist/source/api.js +2 -2
- package/build/dist/source/impl/Data.js +1 -1
- package/build/dist/source/impl/Hooks.d.ts +6 -6
- package/build/dist/source/impl/Hooks.js +19 -21
- package/build/dist/source/impl/Operation.d.ts +2 -2
- package/build/dist/source/impl/Operation.js +109 -97
- package/build/dist/source/impl/Snapshot.d.ts +1 -1
- package/build/dist/source/impl/Snapshot.js +33 -33
- package/build/dist/source/impl/Transaction.js +12 -12
- package/build/dist/source/util/Dbg.d.ts +10 -10
- package/build/dist/source/util/Dbg.js +30 -30
- package/build/dist/source/util/Sealant.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -302,39 +302,30 @@ function reaction(proto, prop, pd) // method only
|
|
|
302
302
|
function cached(proto, prop, pd) // method only
|
|
303
303
|
function options(value: Partial<MemberOptions>): F<any>
|
|
304
304
|
|
|
305
|
-
function noSideEffects(value: boolean) // transaction & cached & reaction
|
|
306
|
-
function sensitiveArgs(value: boolean) // cached & reaction
|
|
307
|
-
function throttling(milliseconds: number) // reaction only
|
|
308
|
-
function reentrance(value: Reentrance) // transaction & reaction
|
|
309
|
-
function monitor(value: Monitor | null)
|
|
310
|
-
function trace(value: Partial<TraceOptions>)
|
|
311
|
-
|
|
312
305
|
function nonreactive<T>(func: F<T>, ...args: any[]): T
|
|
313
306
|
function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
|
|
314
307
|
|
|
315
|
-
//
|
|
308
|
+
// SnapshotOptions, MemberOptions, Kind, Reentrance, Monitor, LoggingOptions, ProfilingOptions
|
|
316
309
|
|
|
317
|
-
interface
|
|
318
|
-
readonly
|
|
319
|
-
readonly
|
|
320
|
-
readonly
|
|
321
|
-
readonly
|
|
322
|
-
readonly
|
|
323
|
-
readonly monitor: Monitor | null
|
|
324
|
-
readonly trace?: Partial<TraceOptions>
|
|
310
|
+
export interface SnapshotOptions {
|
|
311
|
+
readonly hint?: string
|
|
312
|
+
readonly standalone?: StandaloneMode
|
|
313
|
+
readonly journal?: TransactionJournal
|
|
314
|
+
readonly logging?: Partial<LoggingOptions>
|
|
315
|
+
readonly token?: any
|
|
325
316
|
}
|
|
326
317
|
|
|
327
|
-
|
|
318
|
+
interface MemberOptions {
|
|
328
319
|
readonly kind: Kind
|
|
329
320
|
readonly standalone: StandaloneMode
|
|
330
321
|
readonly order: number
|
|
331
322
|
readonly noSideEffects: boolean
|
|
332
|
-
readonly
|
|
323
|
+
readonly triggeringArgs: boolean
|
|
333
324
|
readonly throttling: number // milliseconds, -1 is immediately, Number.MAX_SAFE_INTEGER is never
|
|
334
325
|
readonly reentrance: Reentrance
|
|
335
326
|
readonly journal: TransactionJournal | undefined
|
|
336
327
|
readonly monitor: Monitor | null
|
|
337
|
-
readonly
|
|
328
|
+
readonly logging?: Partial<LoggingOptions>
|
|
338
329
|
}
|
|
339
330
|
|
|
340
331
|
enum Kind {
|
|
@@ -375,8 +366,8 @@ interface Worker {
|
|
|
375
366
|
whenFinished(): Promise<void>
|
|
376
367
|
}
|
|
377
368
|
|
|
378
|
-
interface
|
|
379
|
-
readonly
|
|
369
|
+
interface LoggingOptions {
|
|
370
|
+
readonly off: boolean
|
|
380
371
|
readonly transaction: boolean
|
|
381
372
|
readonly operation: boolean
|
|
382
373
|
readonly step: boolean
|
|
@@ -451,12 +442,12 @@ class Reactronic {
|
|
|
451
442
|
static takeSnapshot<T>(obj: T): T
|
|
452
443
|
static dispose(obj: any): void
|
|
453
444
|
static reactionsAutoStartDisabled: boolean
|
|
454
|
-
static readonly
|
|
455
|
-
static readonly
|
|
456
|
-
static
|
|
457
|
-
static
|
|
458
|
-
static
|
|
459
|
-
static setProfilingMode(
|
|
445
|
+
static readonly isLogging: boolean
|
|
446
|
+
static readonly loggingOptions: LoggingOptions
|
|
447
|
+
static setLoggingMode(isOn: boolean, options?: LoggingOptions)
|
|
448
|
+
static setLoggingHint<T extends object>(obj: T, name: string | undefined): void
|
|
449
|
+
static getLoggingHint<T extends object>(obj: T): string | undefined
|
|
450
|
+
static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void
|
|
460
451
|
}
|
|
461
452
|
|
|
462
453
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
readonly
|
|
1
|
+
export interface LoggingOptions {
|
|
2
|
+
readonly enabled: boolean;
|
|
3
3
|
readonly transaction: boolean;
|
|
4
4
|
readonly operation: boolean;
|
|
5
5
|
readonly step: boolean;
|
|
@@ -22,13 +22,13 @@ export interface ProfilingOptions {
|
|
|
22
22
|
asyncActionDurationWarningThreshold: number;
|
|
23
23
|
garbageCollectionSummaryInterval: number;
|
|
24
24
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
export declare const LoggingLevel: {
|
|
26
|
+
Off: LoggingOptions;
|
|
27
|
+
ErrorsOnly: LoggingOptions;
|
|
28
|
+
Reactions: LoggingOptions;
|
|
29
|
+
Transactions: LoggingOptions;
|
|
30
|
+
Operations: LoggingOptions;
|
|
31
|
+
Debug: LoggingOptions;
|
|
32
32
|
};
|
|
33
33
|
declare global {
|
|
34
34
|
interface Window {
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.LoggingLevel = void 0;
|
|
4
|
+
exports.LoggingLevel = {
|
|
5
|
+
Off: {
|
|
6
|
+
enabled: false,
|
|
7
|
+
transaction: false,
|
|
8
|
+
operation: false,
|
|
9
|
+
step: false,
|
|
10
|
+
monitor: false,
|
|
11
|
+
read: false,
|
|
12
|
+
write: false,
|
|
13
|
+
change: false,
|
|
14
|
+
obsolete: false,
|
|
15
|
+
error: true,
|
|
16
|
+
warning: true,
|
|
17
|
+
gc: false,
|
|
18
|
+
color: 37,
|
|
19
|
+
prefix: '',
|
|
20
|
+
margin1: 0,
|
|
21
|
+
margin2: 0,
|
|
22
|
+
},
|
|
5
23
|
ErrorsOnly: {
|
|
6
|
-
|
|
24
|
+
enabled: true,
|
|
7
25
|
transaction: false,
|
|
8
26
|
operation: false,
|
|
9
27
|
step: false,
|
|
@@ -21,7 +39,7 @@ exports.TraceLevel = {
|
|
|
21
39
|
margin2: 0,
|
|
22
40
|
},
|
|
23
41
|
Reactions: {
|
|
24
|
-
|
|
42
|
+
enabled: true,
|
|
25
43
|
transaction: false,
|
|
26
44
|
operation: false,
|
|
27
45
|
step: false,
|
|
@@ -39,7 +57,7 @@ exports.TraceLevel = {
|
|
|
39
57
|
margin2: 0,
|
|
40
58
|
},
|
|
41
59
|
Transactions: {
|
|
42
|
-
|
|
60
|
+
enabled: true,
|
|
43
61
|
transaction: true,
|
|
44
62
|
operation: false,
|
|
45
63
|
step: false,
|
|
@@ -57,7 +75,7 @@ exports.TraceLevel = {
|
|
|
57
75
|
margin2: 0,
|
|
58
76
|
},
|
|
59
77
|
Operations: {
|
|
60
|
-
|
|
78
|
+
enabled: true,
|
|
61
79
|
transaction: true,
|
|
62
80
|
operation: true,
|
|
63
81
|
step: false,
|
|
@@ -75,7 +93,7 @@ exports.TraceLevel = {
|
|
|
75
93
|
margin2: 0,
|
|
76
94
|
},
|
|
77
95
|
Debug: {
|
|
78
|
-
|
|
96
|
+
enabled: true,
|
|
79
97
|
transaction: true,
|
|
80
98
|
operation: true,
|
|
81
99
|
step: true,
|
|
@@ -92,22 +110,4 @@ exports.TraceLevel = {
|
|
|
92
110
|
margin1: 0,
|
|
93
111
|
margin2: 0,
|
|
94
112
|
},
|
|
95
|
-
Silent: {
|
|
96
|
-
silent: true,
|
|
97
|
-
transaction: false,
|
|
98
|
-
operation: false,
|
|
99
|
-
step: false,
|
|
100
|
-
monitor: false,
|
|
101
|
-
read: false,
|
|
102
|
-
write: false,
|
|
103
|
-
change: false,
|
|
104
|
-
obsolete: false,
|
|
105
|
-
error: true,
|
|
106
|
-
warning: true,
|
|
107
|
-
gc: false,
|
|
108
|
-
color: 37,
|
|
109
|
-
prefix: '',
|
|
110
|
-
margin1: 0,
|
|
111
|
-
margin2: 0,
|
|
112
|
-
},
|
|
113
113
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggingOptions } from './Logging';
|
|
2
2
|
import { StandaloneMode } from './impl/Data';
|
|
3
|
-
export {
|
|
3
|
+
export { LoggingOptions, ProfilingOptions, LoggingLevel } from './Logging';
|
|
4
4
|
import { TransactionJournal } from './impl/TransactionJournal';
|
|
5
5
|
import { Monitor } from './impl/Monitor';
|
|
6
6
|
export interface SnapshotOptions {
|
|
7
7
|
readonly hint?: string;
|
|
8
8
|
readonly standalone?: StandaloneMode;
|
|
9
9
|
readonly journal?: TransactionJournal;
|
|
10
|
-
readonly
|
|
10
|
+
readonly logging?: Partial<LoggingOptions>;
|
|
11
11
|
readonly token?: any;
|
|
12
12
|
}
|
|
13
13
|
export interface MemberOptions {
|
|
@@ -15,12 +15,12 @@ export interface MemberOptions {
|
|
|
15
15
|
readonly standalone: StandaloneMode;
|
|
16
16
|
readonly order: number;
|
|
17
17
|
readonly noSideEffects: boolean;
|
|
18
|
-
readonly
|
|
18
|
+
readonly triggeringArgs: boolean;
|
|
19
19
|
readonly throttling: number;
|
|
20
20
|
readonly reentrance: Reentrance;
|
|
21
21
|
readonly journal: TransactionJournal | undefined;
|
|
22
22
|
readonly monitor: Monitor | null;
|
|
23
|
-
readonly
|
|
23
|
+
readonly logging?: Partial<LoggingOptions>;
|
|
24
24
|
}
|
|
25
25
|
export declare enum Kind {
|
|
26
26
|
Plain = 0,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Reentrance = exports.Kind = exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.Reentrance = exports.Kind = exports.LoggingLevel = void 0;
|
|
4
|
+
var Logging_1 = require("./Logging");
|
|
5
|
+
Object.defineProperty(exports, "LoggingLevel", { enumerable: true, get: function () { return Logging_1.LoggingLevel; } });
|
|
6
6
|
var Kind;
|
|
7
7
|
(function (Kind) {
|
|
8
8
|
Kind[Kind["Plain"] = 0] = "Plain";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F } from './util/Utils';
|
|
2
2
|
import { Controller } from './Controller';
|
|
3
|
-
import { MemberOptions,
|
|
3
|
+
import { MemberOptions, LoggingOptions, ProfilingOptions } from './Options';
|
|
4
4
|
export declare class Rx {
|
|
5
5
|
static why(brief?: boolean): string;
|
|
6
6
|
static getController<T>(method: F<T>): Controller<T>;
|
|
@@ -10,12 +10,12 @@ export declare class Rx {
|
|
|
10
10
|
static dispose(obj: any): void;
|
|
11
11
|
static get reactionsAutoStartDisabled(): boolean;
|
|
12
12
|
static set reactionsAutoStartDisabled(value: boolean);
|
|
13
|
-
static get
|
|
14
|
-
static get
|
|
15
|
-
static
|
|
16
|
-
static
|
|
17
|
-
static
|
|
18
|
-
static setProfilingMode(
|
|
13
|
+
static get isLogging(): boolean;
|
|
14
|
+
static get loggingOptions(): LoggingOptions;
|
|
15
|
+
static setLoggingMode(isOn: boolean, options?: LoggingOptions): void;
|
|
16
|
+
static setLoggingHint<T extends object>(obj: T, name: string | undefined): void;
|
|
17
|
+
static getLoggingHint<T extends object>(obj: T, full?: boolean): string | undefined;
|
|
18
|
+
static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
|
|
19
19
|
}
|
|
20
20
|
export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
|
|
21
21
|
export declare function sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
|
package/build/dist/source/Rx.js
CHANGED
|
@@ -16,12 +16,12 @@ class Rx {
|
|
|
16
16
|
static dispose(obj) { Snapshot_1.Snapshot.dispose(obj); }
|
|
17
17
|
static get reactionsAutoStartDisabled() { return Hooks_1.Hooks.reactionsAutoStartDisabled; }
|
|
18
18
|
static set reactionsAutoStartDisabled(value) { Hooks_1.Hooks.reactionsAutoStartDisabled = value; }
|
|
19
|
-
static get
|
|
20
|
-
static get
|
|
21
|
-
static
|
|
22
|
-
static
|
|
23
|
-
static
|
|
24
|
-
static setProfilingMode(
|
|
19
|
+
static get isLogging() { return Dbg_1.Log.isOn; }
|
|
20
|
+
static get loggingOptions() { return Dbg_1.Log.opt; }
|
|
21
|
+
static setLoggingMode(isOn, options) { Dbg_1.Log.setMode(isOn, options); }
|
|
22
|
+
static setLoggingHint(obj, name) { Hooks_1.Hooks.setHint(obj, name); }
|
|
23
|
+
static getLoggingHint(obj, full = false) { return Data_1.ObjectHolder.getHint(obj, full); }
|
|
24
|
+
static setProfilingMode(isOn, options) { Hooks_1.Hooks.setProfilingMode(isOn, options); }
|
|
25
25
|
}
|
|
26
26
|
exports.Rx = Rx;
|
|
27
27
|
function nonreactive(func, ...args) {
|
|
@@ -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, SnapshotOptions, Kind, Reentrance,
|
|
5
|
+
export { MemberOptions, SnapshotOptions, Kind, Reentrance, LoggingOptions, ProfilingOptions, LoggingLevel } 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.nonreactive = exports.Rx = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.
|
|
3
|
+
exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.nonreactive = exports.Rx = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.LoggingLevel = 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; } });
|
|
@@ -13,7 +13,7 @@ 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, "
|
|
16
|
+
Object.defineProperty(exports, "LoggingLevel", { enumerable: true, get: function () { return Options_1.LoggingLevel; } });
|
|
17
17
|
var Controller_1 = require("./Controller");
|
|
18
18
|
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
19
19
|
var Ref_1 = require("./Ref");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F } from '../util/Utils';
|
|
2
2
|
import { MemberOptions, Kind, Reentrance } from '../Options';
|
|
3
|
-
import {
|
|
3
|
+
import { LoggingOptions, ProfilingOptions } from '../Logging';
|
|
4
4
|
import { MemberName, ObjectHolder, StandaloneMode } from './Data';
|
|
5
5
|
import { TransactionJournal } from './TransactionJournal';
|
|
6
6
|
import { Monitor } from './Monitor';
|
|
@@ -15,12 +15,12 @@ export declare class OptionsImpl implements MemberOptions {
|
|
|
15
15
|
readonly standalone: StandaloneMode;
|
|
16
16
|
readonly order: number;
|
|
17
17
|
readonly noSideEffects: boolean;
|
|
18
|
-
readonly
|
|
18
|
+
readonly triggeringArgs: boolean;
|
|
19
19
|
readonly throttling: number;
|
|
20
20
|
readonly reentrance: Reentrance;
|
|
21
21
|
readonly journal: TransactionJournal | undefined;
|
|
22
22
|
readonly monitor: Monitor | null;
|
|
23
|
-
readonly
|
|
23
|
+
readonly logging?: Partial<LoggingOptions>;
|
|
24
24
|
static readonly INITIAL: Readonly<OptionsImpl>;
|
|
25
25
|
constructor(getter: Function | undefined, setter: Function | undefined, existing: OptionsImpl, patch: Partial<OptionsImpl>, implicit: boolean);
|
|
26
26
|
}
|
|
@@ -41,10 +41,10 @@ export declare class Hooks implements ProxyHandler<ObjectHolder> {
|
|
|
41
41
|
static decorateOperation(implicit: boolean, decorator: Function, options: Partial<MemberOptions>, proto: any, member: MemberName, pd: PropertyDescriptor | undefined): any;
|
|
42
42
|
static decorateOperationParametrized(decorator: Function, options: Partial<MemberOptions>): F<any>;
|
|
43
43
|
static acquireObjectHolder(obj: any): ObjectHolder;
|
|
44
|
-
static
|
|
45
|
-
static setProfilingMode(
|
|
44
|
+
static createObjectHolderForObservableObject(proto: any, unobservable: any, blank: any, hint: string): ObjectHolder;
|
|
45
|
+
static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
|
|
46
46
|
static sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
|
|
47
47
|
static setHint<T>(obj: T, hint: string | undefined): T;
|
|
48
|
-
static
|
|
48
|
+
static createOperation: (h: ObjectHolder, m: MemberName, options: OptionsImpl) => F<any>;
|
|
49
49
|
static rememberOperationOptions: (proto: any, m: MemberName, getter: Function | undefined, setter: Function | undefined, enumerable: boolean, configurable: boolean, options: Partial<MemberOptions>, implicit: boolean) => OptionsImpl;
|
|
50
50
|
}
|
|
@@ -10,7 +10,7 @@ class ObservableObject {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
const proto = new.target.prototype;
|
|
12
12
|
const initial = Data_1.Meta.getFrom(proto, Data_1.Meta.Initial);
|
|
13
|
-
const h = Hooks.
|
|
13
|
+
const h = Hooks.createObjectHolderForObservableObject(proto, this, initial, new.target.name);
|
|
14
14
|
return h.proxy;
|
|
15
15
|
}
|
|
16
16
|
[Symbol.toStringTag]() {
|
|
@@ -24,12 +24,12 @@ const DEFAULT_OPTIONS = Object.freeze({
|
|
|
24
24
|
standalone: false,
|
|
25
25
|
order: 0,
|
|
26
26
|
noSideEffects: false,
|
|
27
|
-
|
|
27
|
+
triggeringArgs: false,
|
|
28
28
|
throttling: Number.MAX_SAFE_INTEGER,
|
|
29
29
|
reentrance: Options_1.Reentrance.PreventWithError,
|
|
30
30
|
journal: undefined,
|
|
31
31
|
monitor: null,
|
|
32
|
-
|
|
32
|
+
logging: undefined,
|
|
33
33
|
});
|
|
34
34
|
class OptionsImpl {
|
|
35
35
|
constructor(getter, setter, existing, patch, implicit) {
|
|
@@ -39,13 +39,13 @@ class OptionsImpl {
|
|
|
39
39
|
this.standalone = merge(DEFAULT_OPTIONS.standalone, existing.standalone, patch.standalone, implicit);
|
|
40
40
|
this.order = merge(DEFAULT_OPTIONS.order, existing.order, patch.order, implicit);
|
|
41
41
|
this.noSideEffects = merge(DEFAULT_OPTIONS.noSideEffects, existing.noSideEffects, patch.noSideEffects, implicit);
|
|
42
|
-
this.
|
|
42
|
+
this.triggeringArgs = merge(DEFAULT_OPTIONS.triggeringArgs, existing.triggeringArgs, patch.triggeringArgs, implicit);
|
|
43
43
|
this.throttling = merge(DEFAULT_OPTIONS.throttling, existing.throttling, patch.throttling, implicit);
|
|
44
44
|
this.reentrance = merge(DEFAULT_OPTIONS.reentrance, existing.reentrance, patch.reentrance, implicit);
|
|
45
45
|
this.journal = merge(DEFAULT_OPTIONS.journal, existing.journal, patch.journal, implicit);
|
|
46
46
|
this.monitor = merge(DEFAULT_OPTIONS.monitor, existing.monitor, patch.monitor, implicit);
|
|
47
|
-
this.
|
|
48
|
-
if (Dbg_1.
|
|
47
|
+
this.logging = merge(DEFAULT_OPTIONS.logging, existing.logging, patch.logging, implicit);
|
|
48
|
+
if (Dbg_1.Log.isOn)
|
|
49
49
|
Object.freeze(this);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -144,18 +144,18 @@ class Hooks {
|
|
|
144
144
|
if (opts.getter === opts.setter) {
|
|
145
145
|
const bootstrap = function () {
|
|
146
146
|
const h = Hooks.acquireObjectHolder(this);
|
|
147
|
-
const
|
|
148
|
-
Object.defineProperty(h.unobservable, member, { value:
|
|
149
|
-
return
|
|
147
|
+
const operation = Hooks.createOperation(h, member, opts);
|
|
148
|
+
Object.defineProperty(h.unobservable, member, { value: operation, enumerable, configurable });
|
|
149
|
+
return operation;
|
|
150
150
|
};
|
|
151
151
|
return Object.defineProperty(proto, member, { get: bootstrap, enumerable, configurable: true });
|
|
152
152
|
}
|
|
153
153
|
else if (opts.setter === Utils_1.UNDEF) {
|
|
154
154
|
const bootstrap = function () {
|
|
155
155
|
const h = Hooks.acquireObjectHolder(this);
|
|
156
|
-
const
|
|
157
|
-
Object.defineProperty(h.unobservable, member, { get:
|
|
158
|
-
return
|
|
156
|
+
const operation = Hooks.createOperation(h, member, opts);
|
|
157
|
+
Object.defineProperty(h.unobservable, member, { get: operation, enumerable, configurable });
|
|
158
|
+
return operation.call(this);
|
|
159
159
|
};
|
|
160
160
|
return Object.defineProperty(proto, member, { get: bootstrap, enumerable, configurable: true });
|
|
161
161
|
}
|
|
@@ -175,14 +175,12 @@ class Hooks {
|
|
|
175
175
|
const initial = Data_1.Meta.getFrom(Object.getPrototypeOf(obj), Data_1.Meta.Initial);
|
|
176
176
|
const rev = new Data_1.ObjectRevision(Snapshot_1.ROOT_REV.snapshot, Snapshot_1.ROOT_REV, Object.assign({}, initial));
|
|
177
177
|
Data_1.Meta.set(rev.data, Data_1.Meta.Holder, h);
|
|
178
|
-
if (Dbg_1.Dbg.isOn)
|
|
179
|
-
Snapshot_1.Snapshot.freezeObjectRevision(rev);
|
|
180
178
|
h = new Data_1.ObjectHolder(obj, obj, Hooks.proxy, rev, obj.constructor.name);
|
|
181
179
|
Data_1.Meta.set(obj, Data_1.Meta.Holder, h);
|
|
182
180
|
}
|
|
183
181
|
return h;
|
|
184
182
|
}
|
|
185
|
-
static
|
|
183
|
+
static createObjectHolderForObservableObject(proto, unobservable, blank, hint) {
|
|
186
184
|
const ctx = Snapshot_1.Snapshot.edit();
|
|
187
185
|
const h = new Data_1.ObjectHolder(unobservable, undefined, Hooks.proxy, Snapshot_1.ROOT_REV, hint);
|
|
188
186
|
ctx.getEditableRevision(h, Data_1.Meta.Holder, blank);
|
|
@@ -191,11 +189,11 @@ class Hooks {
|
|
|
191
189
|
h.proxy[m][Data_1.Meta.Controller].markObsolete();
|
|
192
190
|
return h;
|
|
193
191
|
}
|
|
194
|
-
static setProfilingMode(
|
|
195
|
-
if (
|
|
192
|
+
static setProfilingMode(isOn, options) {
|
|
193
|
+
if (isOn) {
|
|
196
194
|
Hooks.repetitiveUsageWarningThreshold = options && options.repetitiveUsageWarningThreshold !== undefined ? options.repetitiveUsageWarningThreshold : 10;
|
|
197
|
-
Hooks.mainThreadBlockingWarningThreshold = options && options.mainThreadBlockingWarningThreshold !== undefined ? options.mainThreadBlockingWarningThreshold :
|
|
198
|
-
Hooks.asyncActionDurationWarningThreshold = options && options.asyncActionDurationWarningThreshold !== undefined ? options.asyncActionDurationWarningThreshold :
|
|
195
|
+
Hooks.mainThreadBlockingWarningThreshold = options && options.mainThreadBlockingWarningThreshold !== undefined ? options.mainThreadBlockingWarningThreshold : 14;
|
|
196
|
+
Hooks.asyncActionDurationWarningThreshold = options && options.asyncActionDurationWarningThreshold !== undefined ? options.asyncActionDurationWarningThreshold : 300;
|
|
199
197
|
Snapshot_1.Snapshot.garbageCollectionSummaryInterval = options && options.garbageCollectionSummaryInterval !== undefined ? options.garbageCollectionSummaryInterval : 100;
|
|
200
198
|
}
|
|
201
199
|
else {
|
|
@@ -230,8 +228,8 @@ Hooks.mainThreadBlockingWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
|
230
228
|
Hooks.asyncActionDurationWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
231
229
|
Hooks.sensitivity = false;
|
|
232
230
|
Hooks.proxy = new Hooks();
|
|
233
|
-
Hooks.
|
|
234
|
-
throw (0, Dbg_1.misuse)('
|
|
231
|
+
Hooks.createOperation = function (h, m, options) {
|
|
232
|
+
throw (0, Dbg_1.misuse)('createOperation should never be called');
|
|
235
233
|
};
|
|
236
234
|
Hooks.rememberOperationOptions = function (proto, m, getter, setter, enumerable, configurable, options, implicit) {
|
|
237
235
|
throw (0, Dbg_1.misuse)('rememberOperationOptions should never be called');
|
|
@@ -28,7 +28,7 @@ export declare class OperationController extends Controller<any> {
|
|
|
28
28
|
private peek;
|
|
29
29
|
private use;
|
|
30
30
|
private edit;
|
|
31
|
-
private
|
|
31
|
+
private acquireFromRevision;
|
|
32
32
|
private run;
|
|
33
33
|
private static markObsolete;
|
|
34
34
|
}
|
|
@@ -84,7 +84,7 @@ declare class Operation extends Observable implements Observer {
|
|
|
84
84
|
private unsubscribeFromAllObservables;
|
|
85
85
|
private subscribeTo;
|
|
86
86
|
private static canSubscribe;
|
|
87
|
-
private static
|
|
87
|
+
private static createOperation;
|
|
88
88
|
private static rememberOperationOptions;
|
|
89
89
|
static init(): void;
|
|
90
90
|
}
|