Skip to main content

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
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🗃ī¸ Properties​


🏷ī¸ block​

Reference to the node block instance.

info

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​

Context


🏷ī¸ 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​

Node


🏷ī¸ observer​

Reference to the node observer. Can be used to trigger a validation cycle for node.

Type​

Await


🏷ī¸ props​

Reference to the node properties.

Type​

INode


🏷ī¸ 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​

NameTypeOptionalDescription
resetbooleanYesSpecifies if the change flag should reset (default is false).

Return value​

Returns true if the node has changed.