Skip to main content

U2Debug

Defined in: js-api/src/u2core/debug.ts:95

The in-page leak and ownership inspector, DG.U2.debug.

Properties​

PropertyModifierTypeDescriptionDefined in
enabledreadonlybooleanTrue when tracking is on (dev/test). Production: false, and no global strong refs exist.js-api/src/u2core/debug.ts:97

Methods​

diff()​

diff(since): LeakReport

Defined in: js-api/src/u2core/debug.ts:114

What is live now and was not at since.

Parameters​

ParameterType
sinceDebugSnapshot

Returns​

LeakReport


disable()​

disable(): void

Defined in: js-api/src/u2core/debug.ts:102

Turns tracking off and forgets every record.

Returns​

void


enable()​

enable(opts?): void

Defined in: js-api/src/u2core/debug.ts:100

Turns tracking on from now. stacks (default true) captures creation stacks. orphanSeconds (default 10) is the orphan-sweep threshold; 0 disables the sweep.

Parameters​

ParameterType
opts?{ orphanSeconds?: number; stacks?: boolean; }
opts.orphanSeconds?number
opts.stacks?boolean

Returns​

void


listeners()​

listeners(): ListenerRecord[]

Defined in: js-api/src/u2core/debug.ts:110

Listeners on window/document/body added through the scope helpers or while a u2 scope is current.

Returns​

ListenerRecord[]


liveCount()​

liveCount(): number

Defined in: js-api/src/u2core/debug.ts:104

Live scope count — always available (a counter, not a set), tracking on or off.

Returns​

number


liveScopes()​

liveScopes(): ScopeRecord[]

Defined in: js-api/src/u2core/debug.ts:106

Scopes created since tracking was turned on and not disposed yet.

Returns​

ScopeRecord[]


markSingleton()​

markSingleton(scopeOrComponent): void

Defined in: js-api/src/u2core/debug.ts:123

Marks a scope (or a component's scope) as kept for the page's life by design — an overlay host, a tooltip service: it, its descendants and their timers and listeners report label: 'singleton' and never count in LeakReport.total or as orphans.

Parameters​

ParameterType
scopeOrComponentobject

Returns​

void


orphans()​

orphans(): ScopeRecord[]

Defined in: js-api/src/u2core/debug.ts:117

Live control scopes whose root was connected once and has been disconnected for more than orphanSeconds. Each is also console.warned once.

Returns​

ScopeRecord[]


snapshot()​

snapshot(): DebugSnapshot

Defined in: js-api/src/u2core/debug.ts:112

What is live now — pass it to diff later.

Returns​

DebugSnapshot


sweep()​

sweep(): ScopeRecord[]

Defined in: js-api/src/u2core/debug.ts:119

Runs the orphan sweep now and answers orphans.

Returns​

ScopeRecord[]


timers()​

timers(): TimerRecord[]

Defined in: js-api/src/u2core/debug.ts:108

Pending timeouts/intervals/rAFs created through the scope helpers or while a u2 scope is current.

Returns​

TimerRecord[]