Skip to content

feat: version 3.2.0 (#38)#40

Open
franverona wants to merge 6 commits intomainfrom
develop
Open

feat: version 3.2.0 (#38)#40
franverona wants to merge 6 commits intomainfrom
develop

Conversation

@franverona
Copy link
Copy Markdown
Owner

@franverona franverona commented Apr 8, 2026

Issues:

Added

  • Native CustomEvent dispatching across all lifecycle methods in both jQuery and vanilla implementations.
  • Full TypeScript event types: LoadgoEventMap and augmented HTMLImageElement.addEventListener overloads.
  • setprogress() now dispatches loadgo:error when called on an uninitialized element.
  • Interactive demo pages for jQuery and Vanilla JS.
  • New property called onTreshold: map of progress values (0–100) to callbacks. Each callback fires once when progress first reaches or crosses its key.
  • Added pause and resume to CUSTOM_EVENTS
  • loop() now stores loopDuration and syncs loopToggle (the direction flag) into element state on each tick
  • Loadgo.pause() / $el.loadgo('pause'): clears the interval, sets paused: true, fires loadgo:pause with current
    progress — no-op if not looping
  • Loadgo.resume() / $el.loadgo('resume'): restarts the interval from the saved loopToggle and current progress,
    fires loadgo:resume — no-op if not paused
  • Vanilla version extracts a shared _startLoopInterval helper to avoid code duplication between loop() and resume()
  • Added pause() and resume() to LoadgoAPI and jQuery JQuery interface
  • Added loadgo:pause and loadgo:resume to LoadgoEventMap (typed as CustomEvent<LoadgoDetail>)
  • Added Loadgo.initAll(selector, options) for vanilla-JS plugin which allows batch-initializing multiple elements in one call.

Changed

  • loadgo:options detail is now a shallow copy of the merged options object, preventing internal state mutation.
  • Events with no payload (loadgo:init, loadgo:start, loadgo:cycle, loadgo:destroy) set event.detail to null instead of undefined.
  • $filter renamed to filter in jQuery _setprogress internal helper.

Fixed

  • resetprogress() now guards against calls on uninitialized elements (prevented spurious loadgo:reset events).

Events reference

Event Fires when event.detail
loadgo:init init() completes null
loadgo:error invalid usage (non-img element, loop/stop on uninitialized, double loop) { message: string }
loadgo:options options() is called as a setter after init merged LoadgoOptions object
loadgo:progress setprogress() is called { progress: number }
loadgo:complete progress reaches 100 outside of a loop { progress: 100 }
loadgo:reset resetprogress() is called { progress: 0 }
loadgo:start loop() starts null
loadgo:cycle loop completes one full back-and-forth null
loadgo:stop stop() is called { progress: 100 }
loadgo:destroy destroy() completes null

* feat: custom dom events

* fix: error message

* fix: ci now executes on any PR

* fix: eslint

* refactor: events with no details now returns null instead of undefined

* refactor: minor fixes

* docs: updated

* fix: options spread and _setprogress uninitialized guard

* fix: resetprogress guard against uninitialized elements
Repository owner locked and limited conversation to collaborators Apr 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

1 participant