Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

  • Field

Index

Constructors

constructor

  • new Field(connection: ClientConnection, schema: FieldSchema<ParamType>): Field
  • Allows you to perform actions on the field that is being edited.

    Parameters

    • connection: ClientConnection

      message-event-channel connection

    • schema: FieldSchema<ParamType>

      JSON Schema of the field

    Returns Field

Properties

Private connection

connection: ClientConnection

message-event-channel connection

schema

schema: FieldSchema<ParamType>

JSON Schema of the field

Methods

getValue

  • getValue(): Promise<FieldType>
  • Fetch the value of the field

    Example

    const value = await sdk.field.getValue()
    
    console.log(value)

    Returns Promise<FieldType>

isValid

  • isValid(value: FieldType): Promise<Boolean>
  • Check if your value is valid

    Parameters

    • value: FieldType

      The value you wish to test

      Gives the current validity of the field returns a boolean

      Example

      const isValid = await sdk.field.isValid()
      
      console.log(isValid) // false

    Returns Promise<Boolean>

reset

  • reset(): Promise<FieldType>
  • Reset the value to the previously loaded state

    Example

    const resetValue = await sdk.field.reset()
    
    // will be empty content or last saved content
    console.log(resetValue)

    Returns Promise<FieldType>

setValue

  • Change the value of the field

    throws

    Errors are thrown If the value is not set it throws an array of ErrorReport

    Parameters

    • Optional value: FieldType

      The new value you want to set on the field

    Returns Promise<ErrorReport[] | void>

    Example

    try {
     await sdk.field.setValue({ propertyName1: 'hello world' })
    } catch(errors) {
     // failed to set value returns error report
    }

validate

  • validate(value: FieldType): Promise<ErrorReport[] | void>
  • Check the validation of your value. Returns an array containing any JSON Schema errors found.

    Parameters

    • value: FieldType

      The value you whish to test

      If you want to validate a field model and get back an error reports ErrorReport

      Example

      const errors = await sdk.field.validate();
      
      if (errors && errors.length) {
        errors.forEach(error => console.log(error));
      } else {
        // valid
      }

    Returns Promise<ErrorReport[] | void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc