Core API

stop()

Stop the current execution queue.

stop()

The stop() method halts the current execution sequence. It cancels any pending actions in the queue and stops the cursor from performing further movements or interactions.

Use Cases

  • Handling errors: Firing stop() dynamically from within an if() block if a required payment gateway is offline during an e-commerce walkthrough.
  • User cancellation: Binding a keyboard shortcut (like Escape) to instantly stop the virtual cursor walkthrough.

Example

const cursor = new Cursor();

cursor
  .move('#item-1')
  .wait(1000)
  .stop() // The execution stops here. The next line will not run.
  .click('#item-2');

On this page