Function useHaystackRecordTag

  • A hook to use a record tag from an haystack server as react state.

    IMPORTANT: writing is currently only supported with a FIN 5/SkySpark server.

    IMPORTANT: This hooks requires a ClientContext to work.

    See

    https://github.com/j2inn/haystack-nclient

    Example

    Example of usage for a precision tag of type Number.

    const record = useReadByFilter('precision and point and temp and zone and sp').grid[0] // One-shot reading the first record that matches the filter
    const [precision, setPrecision, updatedRecord] = useHaystackRecordTag<HNum>(record, "precision") // Using its tag state

    Returns

    Returns the point value, a function to update it and the point dict.

    Type Parameters

    Type Parameters

    • Value extends HVal<Value>

    Parameters

    • Optional originalRecord: Record

      record dict used to retrieve id and initial value.

    • Optional tagName: string

      name of the tag.

    • pollRate: number = 5

      poll rate for the value subscription. Expressed in seconds.

    Returns [Optional<Value>, RecordTagWriteFunc<Value> | undefined, Optional<Record>]

Generated using TypeDoc