Function useHaystackPoint

  • A hook that allows using a point from an haystack server as react state.

    Important: This hooks requires a ClientContext to work.

    See

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

    Example

    Example of usage with a numeric point.

    const point= useReadByFilter('point and temp and zone and sp').grid[0] // One-shot reading the first point that matches the filter
    const [pointValue, setPointValue, updatedPoint] = useHaystackPoint<HNum>(point) // Using the point state

    Returns

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

    Type Parameters

    Type Parameters

    • Value extends HVal<Value>

    Parameters

    • originaryPoint: Optional<Point<Value>>

      point dict used to retrieve its id and initial value.

    • pollRate: number = 5

      poll rate for the value subscription. Expressed in seconds.

    • Optional writeOptions: HaystackPointWriteOptions

      default options for the write callback.

    Returns [Optional<Value>, PointWriteFunc<Value> | undefined, Optional<Point<Value>>]

Generated using TypeDoc