Skip to main content
Home

Built and signed on GitHub Actions

A class for handling progress

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 years ago (1.1.5)
class Progress

A class for handling progress

Constructors

new
Progress(
totalCount?: number | null,
locale?: string | null,
unit?: string | null,
)

Properties

readonly
Counter: number

Gets the current counter value

readonly
ElapsedTime: DateInterval

Gets the elapsed time since the progress was started

readonly
PercentageCompleted: number | null

Gets the percentage of the progress that has been completed

readonly
StartTime: Date

Gets the start time of the progress

readonly
TotalCount: number | null

Gets the total count of the progress

Methods

calculateEstimatedTimeEnroute(): DateInterval | null

Calculatees the estimated time enroute

Calculates the estimated time of arrival

Increments the counter by 1

on(
eventName: string,
callback: (progress: Progress) => void,
options?: EventOptions,
): void

Adds an event listener

const progress = new Progress();
progress.on('change', (progress) => {
   console.log(progress.toFormattedString());
});
progress.incrementCounter(); // fires the 'change' event
setCounter(value: number): void

Sets the counter to a specific value

setTotalCount(value: number): void

Sets the total count of the progress

Converts the progress to a formatted string

Static Properties

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";
or

Import directly with a jsr specifier

import module from "jsr:@locr-company/js-progress";

Add Package

pnpm i jsr:@locr-company/js-progress
or (using pnpm 10.8 or older)
pnpm dlx jsr add @locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";

Add Package

yarn add jsr:@locr-company/js-progress
or (using Yarn 4.8 or older)
yarn dlx jsr add @locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";

Add Package

vlt install jsr:@locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";

Add Package

npx jsr add @locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";

Add Package

bunx jsr add @locr-company/js-progress

Import symbol

import module from "@locr-company/js-progress";