Installations
npm install rsup-progress
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
>= 6
Node Version
18.13.0
NPM Version
8.19.3
Score
73.9
Supply Chain
98.9
Quality
75.9
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (53.06%)
HTML (23.94%)
SCSS (23%)
Developer
Download Statistics
Total Downloads
112,432
Last Day
108
Last Week
600
Last Month
3,242
Last Year
35,084
GitHub Statistics
308 Stars
120 Commits
10 Forks
5 Watching
3 Branches
2 Contributors
Bundle Size
3.43 kB
Minified
1.36 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.2.0
Package Id
rsup-progress@3.2.0
Unpacked Size
21.85 kB
Size
4.82 kB
File Count
7
NPM Version
8.19.3
Node Version
18.13.0
Publised On
27 Sept 2023
Total Downloads
Cumulative downloads
Total Downloads
112,432
Last day
-27%
108
Compared to previous day
Last week
-33%
600
Compared to previous week
Last month
10%
3,242
Compared to previous month
Last year
6.1%
35,084
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
A lightweight (1KB) progress bar with promise support
The progress bar starts quickly but decelerates over time. Invoke the end
function to finish the animation, providing a natural user experience without an exact percentage of progress.
https://skt-t1-byungi.github.io/rsup-progress/
Example
Using start
and end
methods.
1progress.start() 2 3fetch('/data.json').then(response => { 4 progress.end() 5})
Using promise
method.
1const response = await progress.promise(fetch('/data.json'))
Install
1npm install rsup-progress
1import { Progress } from 'rsup-progress'
Browser ESM
1<script type="module"> 2 import { Progress } from 'https://unpkg.com/rsup-progress/dist/esm/index.js' 3 const progress = new Progress() 4</script>
API
new Progress(options?)
Create an instance.
1const progress = new Progress({ 2 height: 5, 3 color: '#33eafd', 4})
options
height
- Progress bar height. Default is4px
.className
-class
attribute for the progress bar.color
- Progress bar color. Default is#ff1a59
.container
- Element to append a progress bar. Default isdocument.body
.maxWidth
- Maximum width before completion. Default is99.8%
.position
- Position to be placed. Default istop
(There aretop
,bottom
,none
).duration
- Time to reach maxWidth. Default is60000
(ms).hideDuration
- Time to hide when completion. Default is400
(ms).zIndex
- CSS z-index property. Default is9999
.timing
- CSS animation timing function. Default iscubic-bezier(0,1,0,1)
.
progress.setOptions(options)
Change the options.
1progress.setOptions({ 2 color: 'red', 3 className: 'class1 class2', 4})
progress.isInProgress
Check whether the progress bar is active.
1console.log(progress.isInProgress) // => false 2 3progress.start() 4 5console.log(progress.isInProgress) // => true
progress.start()
Activate the progress bar.
progress.end(immediately = false)
Complete the progress bar. If immediately
is set to true, the element is removed instantly.
progress.promise(promise, options?)
Automatically call start and end methods based on the given promise.
1const response = await progress.promise(fetch('/data.json'))
options.min
Minimum time to display and maintain the progress bar. Default is 100
ms. If 0
is set and the promise is already resolved, the progress bar won't appear.
1progress.promise(Promise.resolve(), { min: 0 }) // => Progress bar does not appear.
options.delay
If options.delay
is set, the progress bar will start after the specified delay.
1progress.promise(delay(500), { delay: 200 }) // => It starts 200ms later.
If the promise resolves before the delay, the progress bar won't appear.
1progress.promise(delay(500), { delay: 600 }) // => Progress bar does not appear.
This is useful to prevent "flashing" of the progress bar for short-lived promises.
options.waitAnimation
If options.waitAnimation
is set, the returned promise waits for the hide animation to complete.
1await progress.promise(fetch('/data.json'), { waitAnimation: true }) 2 3alert('Complete!')
Useful for immediate actions like alert
or confirm
. Default is false
.
License
MIT License ❤️📝 skt-t1-byungi
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
3.5
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More