Overview
Three related enhancements to improve progress control and visual feedback.
autoStop
A new boolean option that automatically calls stop() when setprogress(100) is reached, removing boilerplate users currently wire up manually.
Proposed API:
// Vanilla
Loadgo.init(el, { autoStop: true })
// jQuery
$('#logo').loadgo({ autoStop: true })
onThreshold
A new option that fires callbacks when progress crosses specific threshold values. Useful for multi-stage loading UIs (e.g. showing a message at 50%, unlocking a button at 100%).
Thresholds should only fire once per crossing (not on every setprogress call while above the value).
Proposed API:
Loadgo.init(el, {
onThreshold: {
50: () => console.log('halfway there'),
75: () => console.log('almost done'),
100: () => console.log('complete'),
}
})
Progress label
A new option to display the current progress percentage as text inside the overlay. Should support a configurable template string.
Proposed API:
Loadgo.init(el, {
showLabel: true,
labelTemplate: '{progress}%', // default
})
The label element should be styled to be centered over the overlay and excluded when filter mode is active (since there is no overlay in that case).
Notes
- All three options should be supported in both
loadgo.js (jQuery) and loadgo-vanilla.js.
onThreshold composes naturally with the custom events work currently in progress.
autoStop and the 100 threshold in onThreshold are complementary but independent — both can be used together.
Overview
Three related enhancements to improve progress control and visual feedback.
autoStopA new boolean option that automatically calls
stop()whensetprogress(100)is reached, removing boilerplate users currently wire up manually.Proposed API:
onThresholdA new option that fires callbacks when progress crosses specific threshold values. Useful for multi-stage loading UIs (e.g. showing a message at 50%, unlocking a button at 100%).
Thresholds should only fire once per crossing (not on every
setprogresscall while above the value).Proposed API:
Progress label
A new option to display the current progress percentage as text inside the overlay. Should support a configurable template string.
Proposed API:
The label element should be styled to be centered over the overlay and excluded when
filtermode is active (since there is no overlay in that case).Notes
loadgo.js(jQuery) andloadgo-vanilla.js.onThresholdcomposes naturally with the custom events work currently in progress.autoStopand the100threshold inonThresholdare complementary but independent — both can be used together.