npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-progress

v0.0.1

Published

The original Progress Bar component for Electron applications

Downloads

2

Readme

npm

electron-progress

This project is inspired by electron-progressbar

electron-progress provides an easy-to-use and highly customizable API to show and control progress bars on Electron applications.

You can customize the aspects of the windows (electron's BrowserWindow), progress bars' visual aspects (CSS), texts and also all visible information.

For more smooth animation we use the way of the React Scheduler to schedule task.


Table of Contents

Installation

Install with npm:

$ npm i electron-progress

API

Methods

new ProgressBar(options, [electronApp])

Create a new progress bar. Because electron's BrowserWindow is used to display the progress bar and it only works after electron's "ready" event, you have wait for the "ready" event before creating a progress bar; optionally, you can just pass electron's app as a second parameter (electronApp).

| Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | electron-progressbar options | | [options.abortOnError] | boolean | false | Whether progress bar should abort and close if an error occurs internally. | | [options.initialValue] | number | 0 | Progress bar's initial value. Used only for determinate progress bar. | | [options.maxValue] | number | 100 | Progress bar's maximum value. When progress bar's value reaches this number, it will be set to completed and event complete will be fired. Used only for determinate progress bar. | | [options.closeOnComplete] | boolean | true | Whether progress bar window should be automatically closed after completed. If false, the progress bar must be manually closed by calling its close method. | | [options.title] | string | 'Wait...' | Text shown on title bar. | | [options.text] | string | 'Wait...' | Text shown inside the window and below the progress bar. | | [options.detail] | string | | Text shown between text and the progress bar element. Can be used to display detailed information, e.g., the current step of a task. Usually setting this property later is more useful because your application can determine and display, in real time, what is currently happening. | | [options.styleStr] | object | | Visual styles for elements: text, detail, bar and value. All elements properties are purely CSS, just the way it is used in a CSS file. | | [options.centerHtmlStr] | string | | use the html string to change the view of the center of the circle progress | | [options.extraScript] | string | | extra script run in the progress's window | | [options.strokeWidth] | number | 100 | width of progress bar. unit is 'px' | | [options.strokeColor] | string | #236EFF | color of progress bar. | | [options.strokeLinecap] | 'round', 'square' | 'round' | the style of the end of progress bar. | | [options.gapDegree] | number | 0 | the value of the gap of progress bar.| | [options.gapPosition] | 'top', 'bottom', 'left', 'right' | 'bottom' | width of progress bar. | | [options.trailColor] | object | #f3f3f3 | width of progress bar. | | [options.remoteWindow] | instance of BrowserWindow | null | The BrowserWindow to use for the progress bar. When null/empty, a new BrowserWindow will be created. By default, a new BrowserWindow is created, unless this option is specified. | | [options.browserWindow] | object | | Electron's BrowserWindow options. Although only a few options are set by default, you can specify any of Electron's BrowserWindow options. | | [options.browserWindow.parent] | instance of BrowserWindow | null | A BrowserWindow instance. If informed, the progress bar window will always show on top of the parent window and will block it so user can't interact with it until the progress bar is completed/aborted and closed. | | [options.browserWindow.modal] | boolean | true | Whether this is a modal window. This actually only works if progress bar window is a child window, i.e., when its parent is informed. | | [options.browserWindow.resizable] | boolean | false | Whether window is resizable. | | [options.browserWindow.closable] | boolean | false | Whether window is closable. | | [options.browserWindow.minimizable] | boolean | false | Whether window is minimizable. | | [options.browserWindow.maximizable] | boolean | false | Whether window is maximizable. | | [options.browserWindow.width] | number | 450 | Progress bar window's width in pixels. | | [options.browserWindow.height] | number | 175 | Progress bar window's height in pixels. | | [options.browserWindow.webPreferences.nodeIntegration] | boolean | true | Whether node integration is enabled. |


getOptions()object

Return a copy of all current options.


on(eventName, listener)reference to this

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added and called multiple times.

Returns a reference to this so that calls can be chained.

Events

| Event name | Receives parameter | Description | | --- | --- | --- | | ready | | Fired when progress bar is created and ready to be used and controlled. | | progress | value | Available only for determinate progress bar. Fired every time the progress bar's value is changed. The listener receives, as first parameter, the current progress bar's value. | | completed | value | Fired when progress bar is completed, i.e., its value reaches maxValue or method complete is called. The listener receives, as first parameter, the current progress bar's value. | | aborted | value | Fired if progress bar is closed when it's not completed yet, i.e., when user closes progress bar window or method close is called before progress bar is completed. The listener receives, as first parameter, the current progress bar's value. |


setCompleted()

Set progress bar as complete. This means the whole task is finished.


close()

Close progress bar window. If progress bar is not completed yet, it'll be aborted and event aborted will be fired.


isInProgress()boolean

Return true if progress bar is currently in progress, i.e., it hasn't been completed nor aborted yet, otherwise false.


isCompleted()boolean

Return true if progress bar is completed, otherwise false.


Properties

valuenumber

Get or set progress bar's value. Only available for determinate progress bar.


textstring

Get or set the text. This information is shown inside the window and above the progress bar.


detailstring

Get or set the detail. This information is shown between text and the progress bar element. Useful to display any detailed information, e.g., the current status in real time or the current step of the task.


Changelog

Changelog

License

MIT. See LICENSE.md for details.