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
Overview
loop()is currently all-or-nothing — the only way to stop it isstop(), which resets progress to 100. There is no way to freeze the animation in place and pick it back up later.Proposed API
Behaviour
pause()clears the interval but preserves the current progress value and thetoggledirection state, soresume()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 (
visibilitychangeevent) and resuming when the user returns, without resetting the visual state.Notes
loadgo.js(jQuery) andloadgo-vanilla.jsshould be updated.loadgo:pauseandloadgo:resumeDOM event would complement issue feat: emit custom DOM events (e.g. loadgo:complete at 100%) #22 if that is implemented first.