Core API
pause()
Halts the cursor action queue until explicitly resumed.
pause()
Pauses the continuous execution of the action sequence immediately. The cursor will hold its current position and internal state. The sequence remains paused indefinitely until you call next().
stop() acts as an alias to pause().
Use Cases
- Step-by-step guidance: Freezing the presentation cursor while explicitly showing an important warning dialog to the user until they dismiss it.
- Asynchronous processing: Calling
pause()manually before performing a large file upload on behalf of the user, freezing pointer interaction deliberately.
Example
const cursor = new Cursor();
cursor
.move(100, 100)
.pause() // Queue halts here
.move(200, 200);
document.querySelector('.resume-btn').addEventListener('click', () => {
cursor.next(); // Resumes the queue
});