My solution for trigger events in iOS, Android and Desktop

I fought all day looking for a way to trigger events which works in all browsers and systems. I was unexpected, but mousePressed() seems to not work in Safari in iOS if you define a doubleClicked() function.
You could use mousePressed() but… In Android each touch in a button counts double…
I share my solution here, may be is useful for someone.
I simply block the second event in Android with avoiding consecutive clicks.

let lastclick;

function setup() {
   lastclick = 0;

function mousePressed() {
   if (500 < millis() - lastclick) {
      if (b1.contains(mouseX, mouseY)) {
         bp1 += 1;
         state += 1;
    lastclick = millis();

I am testing this here.