• Example

    [SCENARIO 1] where lazy: true could be benefical

    CmpUtils.onAnyCmpValueChanged(() => {
    const useBigData = CmpSimpleBool.getValue();
    if(useBigData) {
    // only now the data will be retrieved from the server
    const bigData = await CmpBigData.getValue();
    }

    }, [CmpBigData, CmpSimpleBool, CmpSimpleText], true);

    [SCENARIO 2] where lazy: false could be benefical

    CmpUtils.onAnyCmpValueChanged(() => {
    // The data for both values has been fetched in the background, so no further server request is necessary
    const bigData1 = await CmpBigData1.getValue();
    const bigData2 = await CmpBigData2.getValue();
    }, [CmpBigData1, CmpBigData2]);

    Type Parameters

    Parameters

    • listener: CmpValuesChangedListener<TInput["name"]>

      Called whenever the value of at least 1 component has changed.
      Returns an object that indicates which components have actually changed.

    • components: TInput[]

      Only call the listener if one of the given cmps have changed

    • lazy: boolean = false

      false [default]: Immediately fetch the values of all changed components.
      true: Trigger the listener but don't fetch values until specifically requested. This could reduce data traffic when only some components are required in the listener, due to conditions or similar.

    Returns void

Generated using TypeDoc