Capítulo 225 de 411

Chapter 225: Draggable.timeSinceDrag()

Core Idea

Returns the seconds elapsed since the last drag ended — both a static method (any recent drag globally) and an instance method (that specific Draggable).

Code Examples

element.addEventListener("click", (e) => {
  if (Draggable.timeSinceDrag() > 0.2) {
    // treat as a genuine click, not the tail end of a drag
  }
});
  • What it demonstrates: distinguishing a real click from the release of a drag gesture, commonly paired with dragClickables: true.

Connects To

  • Draggable vars (dragClickables): needed alongside this pattern so clickable children remain draggable in the first place.