Skip to content

feat: pause() and resume() methods for loop control #43

Description

@franverona

Overview

loop() is currently all-or-nothing — the only way to stop it is stop(), which resets progress to 100. There is no way to freeze the animation in place and pick it back up later.

Proposed API

// Vanilla
Loadgo.pause(el)
Loadgo.resume(el)

// jQuery
$('#logo').loadgo('pause')
$('#logo').loadgo('resume')

Behaviour

  • pause() clears the interval but preserves the current progress value and the toggle direction state, so resume() continues exactly where it left off.
  • resume() on an element that is not looping (or not paused) is a no-op.
  • stop() behaviour is unchanged — it still clears the interval and sets progress to 100.

Motivation

Useful for pausing loading animations when the tab is hidden (visibilitychange event) and resuming when the user returns, without resetting the visual state.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions