Socket
Book a DemoInstallSign in
Socket

@c6digital/pseudo-progress

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@c6digital/pseudo-progress

Create smooth and random pseudo progress bars.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Pseudo Progress

A small JavaScript package to help create smooth and randomised pseudo progress bars.

Installation

Install this package via npm:

npm install @c6digital/pseudo-progress

Usage

import { pseudoProgress } from '@c6digital/pseudo-progress';

const bar = document.getElementById('bar');

pseudoProgress({
    minimumSteps: 4,                        // The minimum number of steps.
    maximumSteps: 8,                        // The maximum number of steps.
    minimumStepDuration: 100,               // The minimum duration of a step.
    maximumStepDuration: 300,               // The maximum duration of a step.
    minimumStepProgress: 10,                // The minimum progress increase for a step.
    maximumStepProgress: 25,                // The maximum progress increase for a step.
    onProgress: (progress: number) => {     // Called after each step and progress increase.
        bar.style.width = `${progress}%`;
    },
    onFinish: () => {                       // Called when all steps are complete and progress is 100.
        console.log('All done!')
    },
})

FAQs

Package last updated on 06 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts