IObservableNode interface
đ Descriptionâ
Interface that describes the observable nodes with in Moment
.
đ Type declarationâ
interface IObservableNode { id: string;Readonly key: string;Readonly node: Node;Readonly props: INode;Readonly block: NodeBlock | undefined;Readonly context: Context;Readonly collectsData: boolean;Readonly hasDataCollected: boolean;Readonly enumerator: number | undefined;Readonly validation: "unknown" | "pass" | "fail";Readonly isFailed: boolean;Readonly isPassed: boolean;Readonly observer: Await | undefined;Readonly hasChanged: (bReset?: boolean) => boolean;Function }
đī¸ Propertiesâ
đˇī¸ block
â
Reference to the node block instance.
When no block is attached to the node, this property is undefined
.
Typeâ
NodeBlock
| undefined
đˇī¸ collectsData
â
Specifies if the node collects data.
Typeâ
boolean
đˇī¸ context
â
Reference to the context.
Typeâ
đˇī¸ enumerator
â
Contains the enumerator for the node. Enumerators are only granted to nodes that have a block that collects data.
Typeâ
number | undefined
đˇī¸ hasDataCollected
â
Specifies if the node has collected data.
Typeâ
boolean
đˇī¸ id
â
Contains a unique identifier for the node.
Typeâ
string
đˇī¸ isFailed
â
Retrieves if the validation of the node failed.
Typeâ
boolean
đˇī¸ isPassed
â
Retrieves if the validation of the node passed.
Typeâ
boolean
đˇī¸ key
â
Contains a unique key for the node within the current context (the key is prefixed with an underscore).
Typeâ
string
đˇī¸ node
â
Reference to the node.
Typeâ
đˇī¸ observer
â
Reference to the node observer. Can be used to trigger a validation cycle for node.
Typeâ
đˇī¸ props
â
Reference to the node properties.
Typeâ
đˇī¸ validation
â
Retrieves the validation state of the node. It can be one of the following values:
unknown
: There is no validation state available yet;pass
: Validation succeeded;fail
: Validation failed.
Typeâ
"unknown" | "pass" | "fail"
âļī¸ Functionsâ
đ§ hasChanged
â
Function to retrieve if the node has changed and needs to be rerendered. This reads out a flag that is set to true
whenever a node changes. The function accepts an optional reset
argument. When true
is supplied to that argument, the flag will reset to false
. Any subsequent call to this function will then return false
until another change is made to the form.
Signatureâ
(reset?: boolean) => boolean
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
reset | boolean | Yes | Specifies if the change flag should reset (default is false ). |
Return valueâ
Returns true
if the node has changed.