Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • FieldType = any

  • ParamType: Params = Params

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

getPath

  • getPath(): Promise<string>

getValue

  • getValue(): 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

  • Constructor
  • Property
  • Method
  • Private property
  • Private method
  • Property
  • Inherited property
  • Protected property

Generated using TypeDoc