Skip to content

@serenity-is/corelib / DeferInitAttribute

Class: DeferInitAttribute

Defined in: src/types/attributes.ts:123

Sets whether a widget class defers its initialization to deferredInit(), which runs once all its constructors are done and may wait, instead of doing it in its constructor, see Widget.isDeferredInit.

  • true: the class defers its initialization, and so must its subclasses. A class that overrides deferredInit() counts as true without it; set it for one that defers without overriding it, e.g. to load its columns asynchronously.
  • false: the class initializes in its constructor, which uses what its base classes initialize, and so must its subclasses.
  • "optional": the class supports both, which its subclasses don't inherit; it defers its initialization when its creator asks for it (WidgetProps.deferInit), else when Widget.defaultDeferInit is on.

Without it, and without a base class that sets true or false, a class follows Widget.defaultDeferInit. A class that is not registered can add it with static { addCustomAttribute(this, Attributes.deferInit()); }.

Extends

Constructors

Constructor

new DeferInitAttribute(value): DeferInitAttribute

Defined in: src/types/attributes.ts:131

Creates a new DeferInitAttribute.

Parameters

value

Whether the class defers its initialization, or "optional" when it supports both. Defaults to true.

boolean | "optional"

Returns

DeferInitAttribute

Overrides

CustomAttribute.constructor

Properties

value

value: boolean | "optional" = true

Defined in: src/types/attributes.ts:131

Whether the class defers its initialization, or "optional" when it supports both. Defaults to true.


[typeInfo]

static [typeInfo]: ClassTypeInfo<"Serenity.">

Defined in: src/types/attributes.ts:124

Overrides

CustomAttribute.[typeInfo]