Call a function while mouse button is held down using EventSystem?

I have a button implementing the IPointerClickHandler interface.

In the OnPointerClick function, I check which mouse button has been pressed and I call a function.

How can I change my code so that the function is called while the mouse button is held down?

public void OnPointerClick(PointerEventData eventData)
 {
     
     if (eventData.button == PointerEventData.InputButton.Left){
     if (FS.FireBEMGT == 1 && !shines360 && mana.baterieSlider.value > 10)
         
         {
             
         shines360 = true;
             countdown = 600;
             torch360.enabled = true;
             mana.baterieSlider.value -= 10;
             source.PlayOneShot (klickon, 0.9f);
             torch360.range = 20;
             thumbNail.SetActive (true);



         }
    }
 if (eventData.button == PointerEventData.InputButton.Right) 
 {
     tooltiptorchlight.SetActive (true);
 }

You have to implement the IPointerDownHandler and IPointerUpHandler interfaces and use a boolean to check whether the mouse button is held down.

private bool rightMouseButtonHeldDown = false;

public void OnPointerDown(PointerEventData eventData)
{
   if (eventData.button == PointerEventData.InputButton.Right) 
  {
      rightMouseButtonHeldDown  = true ;
  }
}

public void OnPointerUp(PointerEventData eventData)
{
   if (eventData.button == PointerEventData.InputButton.Right) 
  {
      rightMouseButtonHeldDown = false;
  }
}

private void Update()
{
    if( rightMouseButtonHeldDown )
    {
        // Call your function
    }
}