{"id":13495720,"url":"https://github.com/skt-t1-byungi/rsup-progress","last_synced_at":"2025-04-06T22:05:55.731Z","repository":{"id":65369892,"uuid":"167944156","full_name":"skt-t1-byungi/rsup-progress","owner":"skt-t1-byungi","description":"❤️ A lightweight (1KB) progress bar with promise support","archived":false,"fork":false,"pushed_at":"2024-04-21T06:27:33.000Z","size":201,"stargazers_count":308,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T15:14:54.647Z","etag":null,"topics":["loader","loading","progress-bar","progressbar","promise"],"latest_commit_sha":null,"homepage":"https://skt-t1-byungi.github.io/rsup-progress/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skt-t1-byungi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-28T10:34:35.000Z","updated_at":"2024-11-12T02:59:25.000Z","dependencies_parsed_at":"2023-09-28T04:30:39.645Z","dependency_job_id":"5e05cde8-8b3a-40ff-a082-bafa75728c8c","html_url":"https://github.com/skt-t1-byungi/rsup-progress","commit_stats":{"total_commits":102,"total_committers":3,"mean_commits":34.0,"dds":0.3137254901960784,"last_synced_commit":"c3def7e34cd34b17dfc06e71b765f1f446e83b67"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skt-t1-byungi%2Frsup-progress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skt-t1-byungi%2Frsup-progress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skt-t1-byungi%2Frsup-progress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skt-t1-byungi%2Frsup-progress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skt-t1-byungi","download_url":"https://codeload.github.com/skt-t1-byungi/rsup-progress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["loader","loading","progress-bar","progressbar","promise"],"created_at":"2024-07-31T19:01:37.535Z","updated_at":"2025-04-06T22:05:55.709Z","avatar_url":"https://github.com/skt-t1-byungi.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./logo.png\"\u003e\n\u003c/div\u003e\n\u003cbr\u003e\u003cbr\u003e\n\n\u003e A lightweight (1KB) progress bar with promise support\n\n[![npm](https://flat.badgen.net/npm/v/rsup-progress)](https://www.npmjs.com/package/rsup-progress)\n[![npm](https://flat.badgen.net/bundlephobia/minzip/rsup-progress)](https://bundlephobia.com/result?p=rsup-progress)\n[![npm](https://flat.badgen.net/npm/license/rsup-progress)](https://github.com/skt-t1-byungi/rsup-progress/blob/master/LICENSE)\n\nThe 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.\n\nhttps://skt-t1-byungi.github.io/rsup-progress/\n\n## Example\n\nUsing `start` and `end` methods.\n\n```js\nprogress.start()\n\nfetch('/data.json').then(response =\u003e {\n    progress.end()\n})\n```\n\nUsing `promise` method.\n\n```js\nconst response = await progress.promise(fetch('/data.json'))\n```\n\n## Install\n\n```sh\nnpm install rsup-progress\n```\n\n```js\nimport { Progress } from 'rsup-progress'\n```\n\n### Browser ESM\n\n```html\n\u003cscript type=\"module\"\u003e\n    import { Progress } from 'https://unpkg.com/rsup-progress/dist/esm/index.js'\n    const progress = new Progress()\n\u003c/script\u003e\n```\n\n## API\n\n### new Progress(options?)\n\nCreate an instance.\n\n```js\nconst progress = new Progress({\n    height: 5,\n    color: '#33eafd',\n})\n```\n\n#### options\n\n-   `height` - Progress bar height. Default is `4px`.\n-   `className` - `class` attribute for the progress bar.\n-   `color` - Progress bar color. Default is `#ff1a59`.\n-   `container` - Element to append a progress bar. Default is `document.body`.\n-   `maxWidth` - Maximum width before completion. Default is `99.8%`.\n-   `position` - Position to be placed. Default is `top` (There are `top`, `bottom`, `none`).\n-   `duration` - Time to reach maxWidth. Default is `60000`(ms).\n-   `hideDuration` - Time to hide when completion. Default is `400`(ms).\n-   `zIndex` - CSS z-index property. Default is `9999`.\n-   `timing` - CSS animation timing function. Default is `cubic-bezier(0,1,0,1)`.\n\n### progress.setOptions(options)\n\nChange the options.\n\n```js\nprogress.setOptions({\n    color: 'red',\n    className: 'class1 class2',\n})\n```\n\n### progress.isInProgress\n\nCheck whether the progress bar is active.\n\n```js\nconsole.log(progress.isInProgress) // =\u003e false\n\nprogress.start()\n\nconsole.log(progress.isInProgress) // =\u003e true\n```\n\n### progress.start()\n\nActivate the progress bar.\n\n### progress.end(immediately = false)\n\nComplete the progress bar. If `immediately` is set to true, the element is removed instantly.\n\n### progress.promise(promise, options?)\n\nAutomatically call start and end methods based on the given promise.\n\n```js\nconst response = await progress.promise(fetch('/data.json'))\n```\n\n#### options.min\n\nMinimum 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.\n\n```js\nprogress.promise(Promise.resolve(), { min: 0 }) // =\u003e Progress bar does not appear.\n```\n\n#### options.delay\n\nIf `options.delay` is set, the progress bar will start after the specified delay.\n\n```js\nprogress.promise(delay(500), { delay: 200 }) // =\u003e It starts 200ms later.\n```\n\nIf the promise resolves before the delay, the progress bar won't appear.\n\n```js\nprogress.promise(delay(500), { delay: 600 }) // =\u003e Progress bar does not appear.\n```\n\nThis is useful to prevent \"flashing\" of the progress bar for short-lived promises.\n\n#### options.waitAnimation\n\nIf `options.waitAnimation` is set, the returned promise waits for the hide animation to complete.\n\n```js\nawait progress.promise(fetch('/data.json'), { waitAnimation: true })\n\nalert('Complete!')\n```\n\nUseful for immediate actions like `alert` or `confirm`. Default is `false`.\n\n## License\n\nMIT License ❤️📝 skt-t1-byungi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskt-t1-byungi%2Frsup-progress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskt-t1-byungi%2Frsup-progress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskt-t1-byungi%2Frsup-progress/lists"}