All Projects → skt-t1-byungi → Rsup Progress

skt-t1-byungi / Rsup Progress

Licence: mit
❤️ A simple progress bar with promises support

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Rsup Progress

React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-40.34%)
Mutual labels:  loading, progress-bar, progressbar
Ngx Ui Loader
Multiple Loaders / spinners and Progress bar for Angular 5, 6, 7 and 8+
Stars: ✭ 368 (+26.9%)
Mutual labels:  loader, loading, progress-bar
Vue Wait
Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
Stars: ✭ 1,869 (+544.48%)
Mutual labels:  loader, loading, progress-bar
Progress bar
Command-line progress bars and spinners for Elixir.
Stars: ✭ 281 (-3.1%)
Mutual labels:  progress-bar, progressbar
cli-progress
⌛ easy to use progress-bar for command-line/terminal applications
Stars: ✭ 672 (+131.72%)
Mutual labels:  progress-bar, progressbar
busy-load
A flexible loading-mask jQuery-plugin
Stars: ✭ 76 (-73.79%)
Mutual labels:  loader, loading
GradientProgressView
一个简单的进度条控件
Stars: ✭ 15 (-94.83%)
Mutual labels:  progress-bar, progressbar
Loaders
Process dialogs, loading bars, etc.
Stars: ✭ 23 (-92.07%)
Mutual labels:  progress-bar, loader
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-91.03%)
Mutual labels:  progress-bar, progressbar
suru
A tqdm-style progress bar in Nim
Stars: ✭ 40 (-86.21%)
Mutual labels:  progress-bar, progressbar
VHProgressBar
Vartical and Horizontal ProgressBar
Stars: ✭ 23 (-92.07%)
Mutual labels:  progress-bar, progressbar
DownloadPorgressBar
This is a download progressbar.
Stars: ✭ 19 (-93.45%)
Mutual labels:  progress-bar, progressbar
rprogress
React ajax loader progress bar with clear API
Stars: ✭ 12 (-95.86%)
Mutual labels:  progress-bar, loader
redux-global-loader
A Redux middleware for global loader
Stars: ✭ 13 (-95.52%)
Mutual labels:  loader, loading
mp-progress
专注于小程序圆环形进度条的小工具
Stars: ✭ 72 (-75.17%)
Mutual labels:  progress-bar, progressbar
LineProgressbar
A light weight jquery progressbar plugin
Stars: ✭ 34 (-88.28%)
Mutual labels:  progress-bar, progressbar
resloader
🎉A image preloaded plugin and can display the loaded image progress bar
Stars: ✭ 20 (-93.1%)
Mutual labels:  promise, loader
ngx-smart-loader
Smart loader handler to manage loaders everywhere in Angular apps.
Stars: ✭ 28 (-90.34%)
Mutual labels:  loader, loading
React Loads
React Loads is a backend agnostic library to help with external data fetching & caching in your UI components.
Stars: ✭ 268 (-7.59%)
Mutual labels:  promise, loading
ngx-loader-indicator
Awesome loader for angular applications. No wrappers only you elements
Stars: ✭ 44 (-84.83%)
Mutual labels:  loader, loading


A simple progress bar with promises support

npm npm npm

The progress bar is initially fast, but doesn't end as it slows down. Call the end function to complete.
This gives users a natural animation without the exact percentage of progress.

https://skt-t1-byungi.github.io/rsup-progress/

Example

Example using start, end method.

progress.start()

fetch('/data.json').then(response => {
    progress.end()
})

Using promise method.

const response = await progress.promise(fetch('/data.json'))

Install

npm i rsup-progress
import Progress from 'rsup-progress'

UMD

<script src="https://unpkg.com/rsup-progress"></script>
<script>
    const progress = new RsupProgress();
</script>

Browser ESM

<script type="module">
    import Progress from 'https://unpkg.com/rsup-progress/dist/index.js';
    const progress = new Progress()
</script>

API

new Progress([options])

Create instance.

const progress = new Progress({
    height: 5,
    color: '#33eafd',
})

options

  • container - Container element to append a progress bar. Default is document.body.
  • position - Position to be placed. Default is top (There are top, bottom, none).
  • maxWidth - Maximum width before completion. Default is 99.8%.
  • height - Progress bar height. Default is 4px.
  • duration - Duration time to reach maxWidth. Default is 60000(ms).
  • hideDuration - Duration time to hide when completion. Default is 400(ms).
  • zIndex - CSS z-index property. Default is 9999.
  • className - Progress bar class attribute.
  • color - Progress bar color. Default is #ff1a59.
  • timing - CSS animation timing function. Default is cubic-bezier(0,1,0,1).

progress.setOptions(options)

Change options.

progress.setOptions({
    color: 'red',
    className: 'class1 class2'
})

progress.isInProgress

Returns whether it is in progress or not.

console.log(progress.isInProgress) // => false

progress.start()

console.log(progress.isInProgress) // => true

progress.start()

Start the progress bar.

progress.end([immediately])

Complete the progress bar. If immediately is true, remove the element immediately.

progress.promise(promise[, delay])

Call the start and end functions automatically by promise.

const response = await progress.promise(fetch('/data.json'))

If delay is given, it starts after a delay.

progress.promise(delay(500), 200) // => It starts 200ms later.

If the promise ends before the delay, the progress bar will not start.

progress.promise(delay(500), 600) // => Progress bar does not appear.

It is useful when avoiding the progressbar flash that occurs when the promise is short.

Tips

Force the Progressbar animation.

If you call the end function before the animation starts, the progressbar does not appear. The animation can be forced with the following trick.

const delay = ms => new Promise(resolve => setTimeout(resolve, ms))

progress.promise(Promise.all([yourPromise, delay(100)])) // => `delay(100)` prevents a quick end.

License

MIT License ❤️📝 skt-t1-byungi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].