Code Monkey home page Code Monkey logo

electron-progressbar's Introduction

NPM downloads NPM total downloads

 
Donate
 
Your help is appreciated! Create a PR or just buy me a coffee

electron-progressbar

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

With electron-progressbar, you can easily customize the appearance of the progress bars, including the visual aspects using CSS, as well as the text and any other visible information. Additionally, the library allows for customization of the Electron BrowserWindow that contains the progress bars.

NPM

Demo

Indeterminate progress bar:
Indeterminate progress bar

Determinate progress bar:
Determinate progress bar

In addition to displaying progress bars within the window, electron-progressbar also enables progress bars to be displayed in the taskbar using the BrowserWindow's setProgressBar method. This feature allows the user to view progress information without needing to switch to the window itself.

example of the taskbar for an indeterminate progress bar:
Taskbar for indeterminate progress bar

example of the taskbar for a determinate progress bar:
Taskbar for determinate progress bar


Table of Contents

Installation

Install with npm:

$ npm i electron-progressbar

Examples

Indeterminate progress bar

Example of an indeterminate progress bar - this progress bar is useful when your application cannot calculate how long the task will take to complete:

Indeterminate progress bar

const {app} = require('electron');
const ProgressBar = require('electron-progressbar');

app.on('ready', function() {
  var progressBar = new ProgressBar({
    text: 'Preparing data...',
    detail: 'Wait...'
  });
  
  progressBar
    .on('completed', function() {
      console.info(`completed...`);
      progressBar.detail = 'Task completed. Exiting...';
    })
    .on('aborted', function() {
      console.info(`aborted...`);
    });
  
  // launch a task...
  // launchTask();
  
  // when task is completed, set the progress bar to completed
  // ps: setTimeout is used here just to simulate an interval between
  // the start and the end of a task
  setTimeout(function() {
    progressBar.setCompleted();
  }, 3000);
});

Determinate progress bar

Example of a determinate progress bar - this progress bar is useful when your application can accurately calculate how long the task will take to complete:

Determinate progress bar

const {app} = require('electron');
const ProgressBar = require('electron-progressbar');

app.on('ready', function() {
  var progressBar = new ProgressBar({
    indeterminate: false,
    text: 'Preparing data...',
    detail: 'Wait...'
  });
  
  progressBar
    .on('completed', function() {
      console.info(`completed...`);
      progressBar.detail = 'Task completed. Exiting...';
    })
    .on('aborted', function(value) {
      console.info(`aborted... ${value}`);
    })
    .on('progress', function(value) {
      progressBar.detail = `Value ${value} out of ${progressBar.getOptions().maxValue}...`;
    });
  
  // launch a task and increase the value of the progress bar for each step completed of a big task;
  // the progress bar is set to completed when it reaches its maxValue (default maxValue: 100);
  // ps: setInterval is used here just to simulate the progress of a task
  setInterval(function() {
    if(!progressBar.isCompleted()){
      progressBar.value += 1;
    }
  }, 20);
});

Progress bar with custom HTML structure (Experimental)

In most scenarios, it's recommended to use the available properties under options to customize the progress bar, ensuring smooth functionality without delving into complex logic. However, if your requirements include a progress bar with unique elements or a distinct HTML structure, the customHTML option gives you full control over the rendering and behavior of the progress bar's elements. Please note that customHTML is an experimental feature.

An example demonstrating the use of the customHTML option can be found here, and a demo can be viewed below:

Progress bar using customHTML


More examples are available in folder examples.

API

Methods

new ProgressBar(options, [electronApp])

Create a new progress bar. It's necessary to wait for the ready event to be emitted by Electron's BrowserWindow, since the progress bar is displayed within it. Optionally, you can pass the electron app as a second parameter (parameter electronApp) when creating the progress bar. Check the sample code on this page for detailed examples on how to set properties to options.

You can define most of the characteristics of the progress bar using the options parameter. Below is a list of properties that you can set for the options parameter.

Option name Type Default value Description
debug boolean false Specifies whether debugging should be enabled. If set to true, the browser's DevTools panel will automatically open when the progress bar is created. This can be helpful when debugging and/or dealing with issues.
abortOnError boolean false Specifies whether the progress bar should automatically abort and close if an error occurs internally.
indeterminate boolean true Specifies whether the progress bar should be indeterminate. If set to false, the progress bar will be determinate.
initialValue number 0 The initial value for the progress bar. This parameter is only applicable for determinate progress bars.
maxValue number 100 The maximum value for the progress bar. When the progress bar's value reaches this number, the progress bar will be considered complete and the complete event will be fired. This parameter is only applicable for determinate progress bars.
closeOnComplete boolean true Specifies whether the progress bar window should be automatically closed after the progress bar completes. If set to false, the progress bar will remain visible until the close method is called by your application.
lang string empty Specifies the value for the lang attribute of the BrowserWindow's <html> tag. This option has no default value, and the lang attribute is only added to <html> when lang is explicitly set. This option can also be helpful in case of font rendering issues.
title string "Wait..." Specifies the text shown on the progress bar window's title bar.
text string "Wait..." Specifies the text shown inside the progress bar window, next to the progress bar.
detail string empty Specifies the text shown between text and the progress bar element. It can be used to display detailed information, such as the current progress of a task. When used for this purpose, it is usually more useful to set this property later so that your application can calculate and display, in real time, the current progress of the task.
style object Specifices the visual styles for the text, detail, bar, and value elements. All properties and values are pure CSS format, in the exact same way they would be used in a CSS file. Check the options for style below.
style.text object An object containing CSS properties for styling the text element.
style.detail object An object containing CSS properties for styling the detail element.
style.bar object {"width":"100%", "background-color":"#BBE0F1"} An object containing CSS properties for styling the bar element of the progress bar.
style.value object {"background-color":"#0976A9"} An object containing CSS properties for styling the value element in the progress bar.
customHTML string empty This experimental option enables you to build the progress bar using custom HTML code. You can provide the full HTML code, starting with the <html> tag, to this option. For more information, see the section Progress bar with custom HTML structure (Experimental).
remoteWindow instance of BrowserWindow null Specifies the BrowserWindow where the progress bar will be displayed. If null/undefined/empty or not specified, a new BrowserWindow will be created to show the progress bar.
browserWindow object Specifies the options for Electron's BrowserWindow. Check the options for browserWindow below. P.S.: although only a few options are set by default, you can specify any of Electron's BrowserWindow options.
browserWindow.parent instance of BrowserWindow null A BrowserWindow instance to be used as the parent of the progress bar's window. If specified, the progress bar window will always be on top of the given parent window and will block user interaction in parent window until the progress bar is completed (or aborted) and closed.
browserWindow.modal boolean true Specifies whether the progress bar's window is a modal window. Note that this property only works when the progress bar's window is a child window, i.e., when browserWindow.parent is specified.
browserWindow.resizable boolean false Specifies whether the user can resize the progress bar's window.
browserWindow.closable boolean false Specifies whether the user can close the progress bar's window.
browserWindow.minimizable boolean false Specifies whether the user can minimize the progress bar's window.
browserWindow.maximizable boolean false Specifies whether the user can maximize the progress bar's window.
browserWindow.width number 450 Specifies the width of the progress bar's window in pixels. Only numeric values are accepted, for example: 600.
browserWindow.height number 175 Specifies the height of the progress bar's window in pixels. Only numeric values are accepted, for example: 600.
browserWindow
.webPreferences.nodeIntegration
boolean true Specifies whether node integration is enabled.
browserWindow
.webPreferences.contextIsolation
boolean false Specifies whether contextIsolation is enabled.

getOptions()object

Return a copy of all the current options.


on(eventName, listener)reference to this

Add the listener function to the end of the listeners array for the event named eventName, and then return a reference to this so that next calls can be chained.
P.S.: there are no checks to verify if listener has already been added. If you call the same combination of eventName and listener multiple times, the listener will be added and executed multiple times as well.

Events

Event name Receives parameter Description
ready none This event is fired when the progress bar has been created and is ready to be used and manipulated.
progress value This event is available only for determinate progress bars. It is fired every time the progress bar's value is changed. The listener receives, as its first parameter, the current value of the progress bar.
completed value This event is fired when the progress bar is completed, i.e., its value reaches maxValue or the complete method is called. The listener receives, as its first parameter, the current value of the progress bar.
aborted value This event is fired if the progress bar is closed before it's completed, i.e., when user closes the progress bar window or the close method is called before the progress bar reaches completion. The listener receives, as its first parameter, the current value of the progress bar.

setCompleted()

Set the progress bar as complete, indicating that the task has finished.

If progress bar is indeterminate, a manual call to this method is required since it's the only way to trigger the completed event and indicate that the task has finished. Otherwise, the progress bar will continue to be displayed indefinitely.


close()

Close the progress bar window. If progress bar has not been completed yet, it will be aborted, and the aborted event will be fired.


isInProgress()boolean

Return true if the progress bar is currently in progress, meaning that it has not been completed or aborted yet; otherwise it will return false;


isCompleted()boolean

Return true if the progress bar is completed, otherwise false.


Properties

valuenumber

This property allows getting or setting the progress bar's current value. It is only applicable and available for determinate progress bars.


textstring

This property allows getting or setting the progress bar's text information that is shown above the progress bar element.


detailstring

This property allows getting or setting the progress bar's detail information that is shown between text and the progress bar element. Useful to display detailed information, such as the current status, in real time, or the current progress of the task.


Changelog

Changelog

License

MIT. See LICENSE.md for details.

electron-progressbar's People

Contributors

altjz avatar andersonmamede avatar kzimny avatar oinochoe avatar stefandeveloper avatar whiteadi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

electron-progressbar's Issues

How to implement progress bar for electron auto updater download progress

How I can implement the progress bar to track the autoUpdater module of electron progress?I've done some tests and I'm unable to get it working correctly, the progress bar if called inside the update-progress event will be opened multiple times.

any suggestion will be appreciated.
Thank you

Progress bar not showing up

Hi, I saw the issue #9 , and did update the progress bar to version 1.2.0, however, I have the same issue, well not exactly the same. When I create a new progress bar on App Ready, it shows the progress bar and it's ok. However, when I start it later, as shown in the following code, I just get a blank window.

Node: 10.15.0
Electron: 4.0.4
electron-progressbar: 1.2.0

Output:
capture

In Addition to the previous, it shows up when the Task is completed.

untitled

Code:


const { app, BrowserWindow, Menu , ipcMain } = require('electron'),
    url = require('url'),
    path = require('path'),
    parser = require('./main/Parser'),
    ProgressBar = require('electron-progressbar');

// process.env.NODE_ENV = 'production';
process.env.NODE_ENV = 'development';

let mainWindow, progressBar;

app.on('ready', () => {
    mainWindow = new BrowserWindow({
        webPreferences: {
            nodeIntegration: false,
            preload: path.join(__dirname, 'assets/js/preload.js')
        }
    });

    mainWindow.loadURL(url.format({
        pathname: path.join(__dirname, 'html/mainWindow.html'),
        protocol: 'file',
        slashes: true
    }));

    mainWindow.on('closed', () => {
        app.quit();
    })

    // Build menut from template
    const mainMenu = Menu.buildFromTemplate(mainMenuTemplate);
    //Insert Menu
    Menu.setApplicationMenu(mainMenu);
})

ipcMain.on('parse:logFiles', (e, item) => {
    parser.setLogFiles(item);
})

ipcMain.on('parse:options', async (e, item) => {
  
    showProgressbar();
    try {
        parser.setOptions(item);
        const {result, parsedFilePath} = await parser.startParse();
        console.log(`App: ${result}, Directory: ${parsedFilePath}`);
        mainWindow.webContents.send('parse:done', parsedFilePath);
        setProgressbarCompleted();
    } catch (error) {
        console.log(error);
    }
})

function showProgressbar () {
	if (progressBar) {
		return;
	}
	
	progressBar = new ProgressBar({
        title: 'Parsing',
		text: 'Parsing files...',
        detail: 'Wait...',
        options: {
            closeOnComplete: false
        },
		browserWindow: {
			parent: mainWindow
        }
	});
	
	progressBar
		.on('completed', function() {
			progressBar.detail = 'Task completed. Exiting...';
			progressBar = null;
		});
}

function setProgressbarCompleted () {
	if (progressBar) {
		progressBar.setCompleted();
	}
}

// Create menut template
const mainMenuTemplate = [
    {
        label: 'File',
        submenu: [
            {
                label: 'Quit',
                accelerator: process.platform === 'darwin' ? 'Command+Q' : 'Ctrl+Q',
                click() {
                    app.quit();
                }
            }
        ]
    }
];

// If mac, add empty object to menu
if (process.platform === 'darwin') {
    mainMenuTemplate.unshift({});
}

// Add developer tools item if not in production
if (process.env.NODE_ENV !== 'production') {
    mainMenuTemplate.push({
        label: 'Developer Tools',
        submenu: [
            {
                label: 'Toggle DevTools',
                accelerator: process.platform === 'darwin' ? 'Command+I' : 'Ctrl+I',
                click(item, focusedWindow) {
                    focusedWindow.toggleDevTools();
                }
            },
            {
                role: 'reload'
            }
        ]
    });
}

Also, even though I have set `` closeOnComplete: false, it still closes the dialog box.


It does not work in TypeScript

I tried to install the package in TypeScript, and i encountered various errors.


node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:8:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: GlobalEvent, NodeEventEmitter, Accelerator, BrowserView, BrowserWindow, ClientRequest, CommandLine, Cookies, Debugger, Dock, DownloadItem, Menu, MenuItem, MessageChannelMain, MessagePortMain, NativeImage, Notification, ServiceWorkers, Session, TouchBar, TouchBarButton, TouchBarColorPicker, TouchBarGroup, TouchBarLabel, TouchBarOtherItemsProxy, TouchBarPopover, TouchBarScrubber, TouchBarSegmentedControl, TouchBarSlider, TouchBarSpacer, Tray, WebContents, WebRequest, clipboard, crashReporter, nativeImage, shell, AboutPanelOptionsOptions, AddRepresentationOptions, AnimationSettings, AppDetailsOptions, AuthenticationResponseDetails, AuthInfo, AutoResizeOptions, BeforeSendResponse, BitmapOptions, BlinkMemoryInfo, BrowserViewConstructorOptions, BrowserWindowConstructorOptions, CertificateTrustDialogOptions, ClearStorageDataOptions, ClientRequestConstructorOptions, Config, ConsoleMessageEvent, ContextMenuParams, CookiesGetFilter, CookiesSetDetails, CrashReporterStartOptions, CreateFromBitmapOptions, CreateFromBufferOptions, CreateInterruptedDownloadOptions, Data, Details, DidChangeThemeColorEvent, DidFailLoadEvent, DidFrameFinishLoadEvent, DidNavigateEvent, DidNavigateInPageEvent, DisplayBalloonOptions, EnableNetworkEmulationOptions, FeedURLOptions, FileIconOptions, FindInPageOptions, FocusOptions, FoundInPageEvent, FromPartitionOptions, HeadersReceivedResponse, HeapStatistics, IgnoreMouseEventsOptions, ImportCertificateOptions, Info, Input, InsertCSSOptions, IpcMessageEvent, Item, JumpListSettings, LoadCommitEvent, LoadFileOptions, LoadURLOptions, LoginItemSettings, LoginItemSettingsOptions, MenuItemConstructorOptions, MessageBoxOptions, MessageBoxReturnValue, MessageBoxSyncOptions, MessageDetails, MessageEvent, MoveToApplicationsFolderOptions, NotificationConstructorOptions, OnBeforeRedirectListenerDetails, OnBeforeRequestListenerDetails, OnBeforeSendHeadersListenerDetails, OnCompletedListenerDetails, OnErrorOccurredListenerDetails, OnHeadersReceivedListenerDetails, OnResponseStartedListenerDetails, OnSendHeadersListenerDetails, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, OpenDialogSyncOptions, OpenExternalOptions, Options, PageFaviconUpdatedEvent, PageTitleUpdatedEvent, Parameters, Payment, PermissionCheckHandlerHandlerDetails, PermissionRequestHandlerHandlerDetails, PluginCrashedEvent, PopupOptions, PreconnectOptions, PrintToPDFOptions, Privileges, ProgressBarOptions, Provider, ReadBookmark, RelaunchOptions, Request, ResizeOptions, ResourceUsage, Response, Result, SaveDialogOptions, SaveDialogReturnValue, SaveDialogSyncOptions, Settings, SourcesOptions, StartLoggingOptions, SystemMemoryInfo, ToBitmapOptions, ToDataURLOptions, ToPNGOptions, TouchBarButtonConstructorOptions, TouchBarColorPickerConstructorOptions, TouchBarConstructorOptions, TouchBarGroupConstructorOptions, TouchBarLabelConstructorOptions, TouchBarPopoverConstructorOptions, TouchBarScrubberConstructorOptions, TouchBarSegmentedControlConstructorOptions, TouchBarSliderConstructorOptions, TouchBarSpacerConstructorOptions, TraceBufferUsageReturnValue, UpdateTargetUrlEvent, UploadProgress, VisibleOnAllWorkspacesOptions, WebContentsPrintOptions, WebviewTagPrintOptions, WillNavigateEvent, EditFlags, FoundInPageResult, Margins, MediaFlags, PageRanges, WebPreferences, DefaultFontFamily, BluetoothDevice, Certificate, CertificatePrincipal, Cookie, CPUUsage, CrashReport, CustomScheme, DesktopCapturerSource, Display, Event, Extension, ExtensionInfo, FileFilter, FilePathWithHeaders, GPUFeatureStatus, InputEvent, IOCounters, IpcMainEvent, IpcMainInvokeEvent, IpcRendererEvent, JumpListCategory, JumpListItem, KeyboardEvent, KeyboardInputEvent, MemoryInfo, MemoryUsageDetails, MimeTypedBuffer, MouseInputEvent, MouseWheelInputEvent, NotificationAction, Point, PostBody, PrinterInfo, ProcessMemoryInfo, ProcessMetric, Product, ProtocolRequest, ProtocolResponse, ProtocolResponseUploadData, Rectangle, Referrer, ScrubberItem, SegmentedControlSegment, ServiceWorkerInfo, SharedWorkerInfo, ShortcutDetails, Size, Task, ThumbarButton, TraceCategoriesAndOptions, TraceConfig, Transaction, UploadData, UploadFile, UploadRawData, WebSource, app, autoUpdater, contentTracing, dialog, globalShortcut, inAppPurchase, IncomingMessage, ipcMain, nativeTheme, net, netLog, powerMonitor, powerSaveBlocker, protocol, screen, session, systemPreferences, webContents, contextBridge, ipcRenderer, webFrame, desktopCapturer, Electron, export=, fs

8 type GlobalEvent = Event;
  ~~~~

  node_modules/electron/electron.d.ts:8:1
    8 type GlobalEvent = Event & { returnValue: any };
      ~~~~
    Conflicts are in this file.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:4592:9 - error TS2300: Duplicate identifier 'IncomingMessage'.

4592   class IncomingMessage extends NodeEventEmitter {
             ~~~~~~~~~~~~~~~

  typings.d.ts:4:13
    4   interface IncomingMessage extends NodeJS.ReadableStream {}
                  ~~~~~~~~~~~~~~~
    'IncomingMessage' was also declared here.
  node_modules/electron/electron.d.ts:4990:9
    4990   class IncomingMessage extends NodeEventEmitter {
                 ~~~~~~~~~~~~~~~
    and here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:5052:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'type' must be of type '"rawKeyDown" | "keyDown" | "keyUp" | "char"', but here has type '"keyDown" | "keyUp" | "char"'.

5052     type: ('keyDown' | 'keyUp' | 'char');
         ~~~~

  node_modules/electron/electron.d.ts:5520:5
    5520     type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
             ~~~~
    'type' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:5724:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type '(UploadRawData | UploadFile)[]', but here has type 'PostData[]'.

5724     data: Array<PostData>;
         ~~~~

  node_modules/electron/electron.d.ts:6479:5
    6479     data: Array<(UploadRawData) | (UploadFile)>;
             ~~~~
    'data' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:8346:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'type' must be of type '"file"', but here has type 'string'.

8346     type: string;
         ~~~~

  node_modules/electron/electron.d.ts:9886:5
    9886     type: 'file';
             ~~~~
    'type' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:8360:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'type' must be of type '"rawData"', but here has type 'string'.

8360     type: string;
         ~~~~

  node_modules/electron/electron.d.ts:9900:5
    9900     type: 'rawData';
             ~~~~
    'type' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11059:5 - error TS2687: All declarations of 'scaleFactor' must have identical modifiers.

11059     scaleFactor: number;
          ~~~~~~~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11059:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'scaleFactor' must be of type 'number | undefined', but here has type 'number'.

11059     scaleFactor: number;
          ~~~~~~~~~~~

  node_modules/electron/electron.d.ts:13063:5
    13063     scaleFactor?: number;
              ~~~~~~~~~~~
    'scaleFactor' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11517:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'redirect' must be of type '"error" | "follow" | "manual" | undefined', but here has type 'string | undefined'.

11517     redirect?: string;
          ~~~~~~~~

  node_modules/electron/electron.d.ts:13620:5
    13620     redirect?: ('follow' | 'error' | 'manual');
              ~~~~~~~~
    'redirect' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11616:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'menuSourceType' must be of type '"none" | "stylus" | "mouse" | "keyboard" | "touch" | "touchMenu" | "longPress" | "longTap" | "touchHandle" | "adjustSelection" | "adjustSelectionReset"', but here has type '"none" | "mouse" | "keyboard" | "touch" | "touchMenu"'.

11616     menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
          ~~~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:13806:5
    13806     menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
              ~~~~~~~~~~~~~~
    'menuSourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11704:5 - error TS2687: All declarations of 'submitURL' must have identical modifiers.

11704     submitURL: string;
          ~~~~~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11704:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'submitURL' must be of type 'string | undefined', but here has type 'string'.

11704     submitURL: string;
          ~~~~~~~~~

  node_modules/electron/electron.d.ts:13904:5
    13904     submitURL?: string;
              ~~~~~~~~~
    'submitURL' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:11913:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'serverType' must be of type '"default" | "json" | undefined', but here has type 'string | undefined'.

11913     serverType?: string;
          ~~~~~~~~~~

  node_modules/electron/electron.d.ts:14236:5
    14236     serverType?: ('json' | 'default');
              ~~~~~~~~~~
    'serverType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12091:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'file' must be of type 'string', but here has type 'string | string[]'.

12091     file: (string[]) | (string);
          ~~~~

  node_modules/electron/electron.d.ts:14506:5
    14506     file: string;
              ~~~~
    'file' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12147:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'postData' must be of type '(UploadRawData | UploadFile)[] | undefined', but here has type 'UploadRawData[] | UploadFile[] | UploadBlob[] | undefined'.

12147     postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
          ~~~~~~~~

  node_modules/electron/electron.d.ts:14575:5
    14575     postData?: Array<(UploadRawData) | (UploadFile)>;
              ~~~~~~~~
    'postData' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12226:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'role' must be of type '"window" | "hide" | "reload" | "copy" | "cut" | "paste" | "close" | "quit" | "minimize" | "undo" | "redo" | "pasteAndMatchStyle" | "delete" | "selectAll" | "forceReload" | "toggleDevTools" | ... 31 more ... | undefined', but here has type '"window" | "hide" | "reload" | "copy" | "cut" | "paste" | "close" | "quit" | "minimize" | "undo" | "redo" | "pasteAndMatchStyle" | "delete" | "selectAll" | "forceReload" | "toggleDevTools" | ... 25 more ... | undefined'.

12226     role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
          ~~~~

  node_modules/electron/electron.d.ts:14666:5
    14666     role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'showSubstitutions' | 'toggleSmartQuotes' | 'toggleSmartDashes' | 'toggleTextReplacement' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
              ~~~~
    'role' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12342:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'icon' must be of type 'string | NativeImage | undefined', but here has type 'NativeImage | undefined'.

12342     icon?: NativeImage;
          ~~~~

  node_modules/electron/electron.d.ts:14795:5
    14795     icon?: (NativeImage) | (string);
              ~~~~
    'icon' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12459:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'source' must be of type '"worker" | "network" | "storage" | "other" | "security" | "javascript" | "xml" | "console-api" | "rendering" | "deprecation" | "violation" | "intervention" | "recommendation"', but here has type '"worker" | "network" | "storage" | "other" | "security" | "javascript" | "xml" | "console-api" | "rendering" | "deprecation" | "violation" | "intervention" | "recommendation" | "app-cache"'.

12459     source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
          ~~~~~~

  node_modules/electron/electron.d.ts:14916:5
    14916     source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
              ~~~~~~
    'source' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12506:5 - error TS2687: All declarations of 'title' must have identical modifiers.

12506     title: string;
          ~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12506:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'title' must be of type 'string | undefined', but here has type 'string'.

12506     title: string;
          ~~~~~

  node_modules/electron/electron.d.ts:14949:5
    14949     title?: string;
              ~~~~~
    'title' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12517:5 - error TS2687: All declarations of 'body' must have identical modifiers.

12517     body: string;
          ~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12517:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'body' must be of type 'string | undefined', but here has type 'string'.

12517     body: string;
          ~~~~

  node_modules/electron/electron.d.ts:14960:5
    14960     body?: string;
              ~~~~
    'body' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12577:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12577     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15033:5
    15033     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12596:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12596     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15058:5
    15058     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12607:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12607     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15075:5
    15075     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12618:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12618     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15093:5
    15093     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12633:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12633     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15114:5
    15114     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12648:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12648     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15135:5
    15135     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12662:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12662     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15154:5
    15154     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12679:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'resourceType' must be of type '"object" | "media" | "font" | "script" | "image" | "other" | "ping" | "mainFrame" | "subFrame" | "stylesheet" | "xhr" | "cspReport" | "webSocket"', but here has type 'string'.

12679     resourceType: string;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15177:5
    15177     resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
              ~~~~~~~~~~~~
    'resourceType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12691:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'mode' must be of type '"left" | "bottom" | "right" | "detach" | "undocked"', but here has type '"bottom" | "right" | "detach" | "undocked"'.

12691     mode: ('right' | 'bottom' | 'undocked' | 'detach');
          ~~~~

  node_modules/electron/electron.d.ts:15189:5
    15189     mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
              ~~~~
    'mode' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12850:5 - error TS2687: All declarations of 'securityOrigin' must have identical modifiers.

12850     securityOrigin: string;
          ~~~~~~~~~~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12850:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'securityOrigin' must be of type 'string | undefined', but here has type 'string'.

12850     securityOrigin: string;
          ~~~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15370:5
    15370     securityOrigin?: string;
              ~~~~~~~~~~~~~~
    'securityOrigin' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12854:5 - error TS2687: All declarations of 'mediaType' must have identical modifiers.

12854     mediaType: ('video' | 'audio' | 'unknown');
          ~~~~~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12854:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'mediaType' must be of type '"audio" | "video" | "unknown" | undefined', but here has type '"audio" | "video" | "unknown"'.

12854     mediaType: ('video' | 'audio' | 'unknown');
          ~~~~~~~~~

  node_modules/electron/electron.d.ts:15374:5
    15374     mediaType?: ('video' | 'audio' | 'unknown');
              ~~~~~~~~~
    'mediaType' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12858:5 - error TS2687: All declarations of 'requestingUrl' must have identical modifiers.

12858     requestingUrl: string;
          ~~~~~~~~~~~~~

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12858:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'requestingUrl' must be of type 'string | undefined', but here has type 'string'.

12858     requestingUrl: string;
          ~~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:15379:5
    15379     requestingUrl?: string;
              ~~~~~~~~~~~~~
    'requestingUrl' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:12949:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'pageRanges' must be of type 'string | undefined', but here has type 'Record<string, number> | undefined'.

12949     pageRanges?: Record<string, number>;
          ~~~~~~~~~~

  node_modules/electron/electron.d.ts:15481:5
    15481     pageRanges?: string;
              ~~~~~~~~~~
    'pageRanges' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14044:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'BrowserView' must be of type 'typeof BrowserView', but here has type 'typeof BrowserView'.

14044     BrowserView: typeof BrowserView;
          ~~~~~~~~~~~

  node_modules/electron/electron.d.ts:16932:5
    16932     BrowserView: typeof BrowserView;
              ~~~~~~~~~~~
    'BrowserView' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14045:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'BrowserWindow' must be of type 'typeof BrowserWindow', but here has type 'typeof BrowserWindow'.

14045     BrowserWindow: typeof BrowserWindow;
          ~~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:16933:5
    16933     BrowserWindow: typeof BrowserWindow;
              ~~~~~~~~~~~~~
    'BrowserWindow' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14061:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'Menu' must be of type 'typeof Menu', but here has type 'typeof Menu'.

14061     Menu: typeof Menu;
          ~~~~

  node_modules/electron/electron.d.ts:16942:5
    16942     Menu: typeof Menu;
              ~~~~
    'Menu' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14062:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'MenuItem' must be of type 'typeof MenuItem', but here has type 'typeof MenuItem'.

14062     MenuItem: typeof MenuItem;
          ~~~~~~~~

  node_modules/electron/electron.d.ts:16943:5
    16943     MenuItem: typeof MenuItem;
              ~~~~~~~~
    'MenuItem' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14069:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'Notification' must be of type 'typeof Notification', but here has type 'typeof Notification'.

14069     Notification: typeof Notification;
          ~~~~~~~~~~~~

  node_modules/electron/electron.d.ts:16949:5
    16949     Notification: typeof Notification;
              ~~~~~~~~~~~~
    'Notification' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14075:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'session' must be of type 'typeof Session', but here has type 'typeof Session'.

14075     session: typeof Session;
          ~~~~~~~

  node_modules/electron/electron.d.ts:16956:5
    16956     session: typeof Session;
              ~~~~~~~
    'session' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14078:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'TouchBar' must be of type 'typeof TouchBar', but here has type 'typeof TouchBar'.

14078     TouchBar: typeof TouchBar;
          ~~~~~~~~

  node_modules/electron/electron.d.ts:16960:5
    16960     TouchBar: typeof TouchBar;
              ~~~~~~~~
    'TouchBar' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14089:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'Tray' must be of type 'typeof Tray', but here has type 'typeof Tray'.

14089     Tray: typeof Tray;
          ~~~~

  node_modules/electron/electron.d.ts:16961:5
    16961     Tray: typeof Tray;
              ~~~~
    'Tray' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14090:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'webContents' must be of type 'typeof WebContents', but here has type 'typeof WebContents'.

14090     webContents: typeof WebContents;
          ~~~~~~~~~~~

  node_modules/electron/electron.d.ts:16963:5
    16963     webContents: typeof WebContents;
              ~~~~~~~~~~~
    'webContents' was also declared here.

node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:14998:14 - error TS2717: Subsequent property declarations must have the same type.  Property 'type' must be of type '"worker" | "browser" | "renderer" | "utility"', but here has type '"worker" | "browser" | "renderer"'.

14998     readonly type: ('browser' | 'renderer' | 'worker');
                   ~~~~

  node_modules/electron/electron.d.ts:18359:14
    18359     readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
                       ~~~~
    'type' was also declared here.

node_modules/electron/electron.d.ts:8:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: GlobalEvent, NodeEventEmitter, Accelerator, BrowserView, BrowserWindow, ClientRequest, CommandLine, Cookies, Debugger, Dock, DownloadItem, Menu, MenuItem, MessageChannelMain, MessagePortMain, NativeImage, Notification, ServiceWorkers, Session, TouchBar, TouchBarButton, TouchBarColorPicker, TouchBarGroup, TouchBarLabel, TouchBarOtherItemsProxy, TouchBarPopover, TouchBarScrubber, TouchBarSegmentedControl, TouchBarSlider, TouchBarSpacer, Tray, WebContents, WebRequest, clipboard, crashReporter, nativeImage, shell, AboutPanelOptionsOptions, AddRepresentationOptions, AnimationSettings, AppDetailsOptions, AuthenticationResponseDetails, AuthInfo, AutoResizeOptions, BeforeSendResponse, BitmapOptions, BlinkMemoryInfo, BrowserViewConstructorOptions, BrowserWindowConstructorOptions, CertificateTrustDialogOptions, ClearStorageDataOptions, ClientRequestConstructorOptions, Config, ConsoleMessageEvent, ContextMenuParams, CookiesGetFilter, CookiesSetDetails, CrashReporterStartOptions, CreateFromBitmapOptions, CreateFromBufferOptions, CreateInterruptedDownloadOptions, Data, Details, DidChangeThemeColorEvent, DidFailLoadEvent, DidFrameFinishLoadEvent, DidNavigateEvent, DidNavigateInPageEvent, DisplayBalloonOptions, EnableNetworkEmulationOptions, FeedURLOptions, FileIconOptions, FindInPageOptions, FocusOptions, FoundInPageEvent, FromPartitionOptions, HeadersReceivedResponse, HeapStatistics, IgnoreMouseEventsOptions, ImportCertificateOptions, Info, Input, InsertCSSOptions, IpcMessageEvent, Item, JumpListSettings, LoadCommitEvent, LoadFileOptions, LoadURLOptions, LoginItemSettings, LoginItemSettingsOptions, MenuItemConstructorOptions, MessageBoxOptions, MessageBoxReturnValue, MessageBoxSyncOptions, MessageDetails, MessageEvent, MoveToApplicationsFolderOptions, NotificationConstructorOptions, OnBeforeRedirectListenerDetails, OnBeforeRequestListenerDetails, OnBeforeSendHeadersListenerDetails, OnCompletedListenerDetails, OnErrorOccurredListenerDetails, OnHeadersReceivedListenerDetails, OnResponseStartedListenerDetails, OnSendHeadersListenerDetails, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, OpenDialogSyncOptions, OpenExternalOptions, Options, PageFaviconUpdatedEvent, PageTitleUpdatedEvent, Parameters, Payment, PermissionCheckHandlerHandlerDetails, PermissionRequestHandlerHandlerDetails, PluginCrashedEvent, PopupOptions, PreconnectOptions, PrintToPDFOptions, Privileges, ProgressBarOptions, Provider, ReadBookmark, RelaunchOptions, Request, ResizeOptions, ResourceUsage, Response, Result, SaveDialogOptions, SaveDialogReturnValue, SaveDialogSyncOptions, Settings, SourcesOptions, StartLoggingOptions, SystemMemoryInfo, ToBitmapOptions, ToDataURLOptions, ToPNGOptions, TouchBarButtonConstructorOptions, TouchBarColorPickerConstructorOptions, TouchBarConstructorOptions, TouchBarGroupConstructorOptions, TouchBarLabelConstructorOptions, TouchBarPopoverConstructorOptions, TouchBarScrubberConstructorOptions, TouchBarSegmentedControlConstructorOptions, TouchBarSliderConstructorOptions, TouchBarSpacerConstructorOptions, TraceBufferUsageReturnValue, UpdateTargetUrlEvent, UploadProgress, VisibleOnAllWorkspacesOptions, WebContentsPrintOptions, WebviewTagPrintOptions, WillNavigateEvent, EditFlags, FoundInPageResult, Margins, MediaFlags, PageRanges, WebPreferences, DefaultFontFamily, BluetoothDevice, Certificate, CertificatePrincipal, Cookie, CPUUsage, CrashReport, CustomScheme, DesktopCapturerSource, Display, Event, Extension, ExtensionInfo, FileFilter, FilePathWithHeaders, GPUFeatureStatus, InputEvent, IOCounters, IpcMainEvent, IpcMainInvokeEvent, IpcRendererEvent, JumpListCategory, JumpListItem, KeyboardEvent, KeyboardInputEvent, MemoryInfo, MemoryUsageDetails, MimeTypedBuffer, MouseInputEvent, MouseWheelInputEvent, NotificationAction, Point, PostBody, PrinterInfo, ProcessMemoryInfo, ProcessMetric, Product, ProtocolRequest, ProtocolResponse, ProtocolResponseUploadData, Rectangle, Referrer, ScrubberItem, SegmentedControlSegment, ServiceWorkerInfo, SharedWorkerInfo, ShortcutDetails, Size, Task, ThumbarButton, TraceCategoriesAndOptions, TraceConfig, Transaction, UploadData, UploadFile, UploadRawData, WebSource, app, autoUpdater, contentTracing, dialog, globalShortcut, inAppPurchase, IncomingMessage, ipcMain, nativeTheme, net, netLog, powerMonitor, powerSaveBlocker, protocol, screen, session, systemPreferences, webContents, contextBridge, ipcRenderer, webFrame, desktopCapturer, Electron, export=, fs

8 type GlobalEvent = Event & { returnValue: any };
  ~~~~

  node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:8:1
    8 type GlobalEvent = Event;
      ~~~~
    Conflicts are in this file.

node_modules/electron/electron.d.ts:4990:9 - error TS2300: Duplicate identifier 'IncomingMessage'.

4990   class IncomingMessage extends NodeEventEmitter {
             ~~~~~~~~~~~~~~~

  node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:4592:9
    4592   class IncomingMessage extends NodeEventEmitter {
                 ~~~~~~~~~~~~~~~
    'IncomingMessage' was also declared here.

node_modules/electron/electron.d.ts:13063:5 - error TS2687: All declarations of 'scaleFactor' must have identical modifiers.

13063     scaleFactor?: number;
          ~~~~~~~~~~~

node_modules/electron/electron.d.ts:13904:5 - error TS2687: All declarations of 'submitURL' must have identical modifiers.

13904     submitURL?: string;
          ~~~~~~~~~

node_modules/electron/electron.d.ts:14949:5 - error TS2687: All declarations of 'title' must have identical modifiers.

14949     title?: string;
          ~~~~~

node_modules/electron/electron.d.ts:14960:5 - error TS2687: All declarations of 'body' must have identical modifiers.

14960     body?: string;
          ~~~~

node_modules/electron/electron.d.ts:15370:5 - error TS2687: All declarations of 'securityOrigin' must have identical modifiers.

15370     securityOrigin?: string;
          ~~~~~~~~~~~~~~

node_modules/electron/electron.d.ts:15374:5 - error TS2687: All declarations of 'mediaType' must have identical modifiers.

15374     mediaType?: ('video' | 'audio' | 'unknown');
          ~~~~~~~~~

node_modules/electron/electron.d.ts:15379:5 - error TS2687: All declarations of 'requestingUrl' must have identical modifiers.

15379     requestingUrl?: string;
          ~~~~~~~~~~~~~

typings.d.ts:4:13 - error TS2300: Duplicate identifier 'IncomingMessage'.

4   interface IncomingMessage extends NodeJS.ReadableStream {}
              ~~~~~~~~~~~~~~~

  node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:4592:9
    4592   class IncomingMessage extends NodeEventEmitter {
                 ~~~~~~~~~~~~~~~
    'IncomingMessage' was also declared here.


Found 58 errors in 3 files.

Errors  Files
    48  node_modules/@types/electron-progressbar/node_modules/electron/electron.d.ts:8
     9  node_modules/electron/electron.d.ts:8
     1  typings.d.ts:4

Can anyone suggest any solution how to work this in TS, or any workaround?

hide or show progressbar window

How to hide or show progressbar window? tried to use browserWindow show and hide methods but they doesnt work

Tried this:
.on('aborted', () => {
event.preventDefault();
progressBar.hide()
})

Closing progressBar window does not clear application progress bar

Am I correct that the proper way to trigger the .on('aborted') event is to allow the ProgressBar to be closable, like this?

const progressBar = new ProgressBar(
    {
      text: 'Something is happening...',
      browserWindow: { closable: true }, // <-- this makes it closable
      closeOnComplete: true,
    }
)

However, when the ProgressBar gets closed on MacOS, the application progress bar (shown in the Taskbar - what MacOS calls the "Dock") shows the progress stuck in the same state it was when the ProgressBar window was closed. I haven't tested on Windows, so I don't know if the problem exists there too.

I've tried this, but it doesn't seem to work:

progressBar.on('abort', () => {
  progressBar.setCompleted()
})

Am I missing something? If not, I can look into submitting a pull request to fix.

Include electron-progressbar in project and app's package size increased

Hi
My electron application package size was 60M originally , but after the import electron-progressbar, the packet size increased to 109M.
I found the dependencies of electron-progressbar is :

"dependencies": {
    "extend": "^3.0.1",
    "electron": "^1.7.5"
}

Is electron is the necessary dependency of this module?
When I edit the package.json of this module, set electron as a devDependencies of this module, the app pkg size was decreased.

It does not work properly with Electron 12

Hi,

Today morning I upgraded my codebase from Electron 11 to the latest Electron 12 (12.0.7) and noticed an issue.

When Progress dialogue shows, but the progress bar is disappeared from the dialogue.

I use customized style so I removed It but did not solve the issue.

I removed each parameters so I have now only this code:

let progressBar = new ProgressBar({ text: 'File uploading', detail: 'Please wait...' });

but it is the same, unfortunately, does not solve the problem.

If I roll back the code to Electron 11 then It works so It seems to be an Electron 12 related issue.

Progress bar not showing but getting require is not defined

I am using electron 5.0.0
node - 11.1.0
npm - 6.9.0
electron-progressbar - 1.2.0

I am getting an error in require("electron").ipcRenderer.on("CREATE_PROGRESS_BAR", (event, settings) => { this line.

After I add this line webPreferences: {nodeIntegration: true} in browserWindow options...it started working. Could you please fix this.

Progress bar details not being displayed other than window title

I have been trying to show a progress-bar window with the codes that are provided in the readme document. Unfortunately, I am not able to get the htmlcontent of the progressbar in the window.
Here is a snippet of code:

const { app, BrowserWindow, ipcMain, Notification, dialog, ipcRenderer, Menu, shell, session } = require('electron'); const ProgressBar = require('electron-progressbar');

let loginWindow, progressBar;

async function createWindow() {
    loginWindow = new BrowserWindow({
        width: constantData.size.loginScreen.width,
        height: constantData.size.loginScreen.height,
        icon: path.join(__dirname, 'public/icon/favicon.ico'),
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false,
            enableRemoteModule: true
        }
    });

    loginWindow.once('ready-to-show', () => {
        autoUpdater.checkForUpdatesAndNotify();
    });

    var cookieResults = await getCookies();
    await loginWindow.loadFile(path.join(__dirname, 'src\\view\\index.html'),
        {
            query: {
                "cookie": cookieResults
            }
        });
        showProgressbar(loginWindow);
}
ipcMain.on('show-progressbar', showProgressbar);
ipcMain.on('set-progressbar-completed', setProgressbarCompleted);
function showProgressbar(window = dashboardWindow) {
    if (progressBar) {
        return;
    }

    progressBar = new ProgressBar({
        text: 'Preparing data...',
        detail: 'Wait...',
        text: 'Preparing to fetching your data for the initial load',
        browserWindow: {
            parent: window,
            webPreferences: {
                nodeIntegration: true
            }
        }
    });

    progressBar
        .on('completed', function () {
            progressBar.detail = 'Task completed. Exiting...';
            progressBar = null;
        });
}`

function setProgressbarCompleted() {
    if (progressBar) {
        progressBar.setCompleted();
    }
}

app.on('ready', () => { createWindow(); });

Here is the UI:
image

Progress-bar not show in electron-vue

hello, sir i am using electron with vue-cli-3, but Progress-bar don't show

electron: 4.0.0
vue-cli: 3
node: 10.11.0
chrome: 69
  • background.js
'use strict'

import { app, protocol, BrowserWindow, ipcMain, dialog, globalShortcut } from 'electron'
import { createProtocol, installVueDevtools } from 'vue-cli-plugin-electron-builder/lib'

const APPP = require('../package.json') // Load Package JSON File

const isDevelopment = process.env.NODE_ENV !== 'production'

const ProgressBar = require('electron-progressbar');

// Main Window
let win
let progressBar

// Standard scheme must be registered before the app is ready
protocol.registerStandardSchemes(['app'], { secure: true })
function createWindow() {

  /**
   * Create the Main window
   */
  win = new BrowserWindow({
    show: false,
    title: APPP.productName + ' ' + APPP.version,
  })
  win.maximize()
  win.show()
  win.on('page-title-updated', (evt) => {
    evt.preventDefault();
  });

  if (isDevelopment || process.env.IS_TEST) {

    // Load the url of the dev server if in development mode
    win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)

    if (!process.env.IS_TEST) win.webContents.openDevTools()
  } else {
    createProtocol('app')
    // Load the index.html when not in development
    win.loadURL('app://./index.html')
  }

  win.on('closed', () => {
    win = null
  })
}

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On macOS it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  // On macOS it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow()
  }
})

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', async () => {
 
  progressBar = new ProgressBar({
    // indeterminate: false,
    text: 'Preparing data...',
    detail: 'Wait...',
    browserWindow: {
      parent: win,
    }
  });

  progressBar
    .on('completed', function() {
      console.info(`completed...`);
      progressBar.detail = 'Task completed. Exiting...';
    })
    .on('aborted', function() {
      console.info(`aborted...`);
      dialog.showMessageBox(win, {
        type: 'warning',
        title: 'Task aborted',
        message: 'Task was aborted.',
        detail: 'Exiting...'
      }, function(){});
    });
  
  // ps: setTimeout is used here just to simulate an interval between the start and the end of a task
  setTimeout(function() {
    progressBar.setCompleted();
  }, 33000);

  if (isDevelopment && !process.env.IS_TEST) {
    // Install Vue Devtools
    await installVueDevtools()
  }

  createWindow()
})

// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
  if (process.platform === 'win32') {
    process.on('message', data => {
      if (data === 'graceful-exit') {
        app.quit()
      }
    })
  } else {
    process.on('SIGTERM', () => {
      app.quit()
    })
  }
}

Output:

capture

App Icon Progress Bar Doesn't Reset On Abort

Hi and thanks for this lib.

OSX 10.14.5
Electron 4.2.10

I've just trying it out and notice the the app icon progress bar does not go away when a progressBar instance is aborted through the window "close" button.
Screen Shot 2019-09-09 at 8 17 38 PM (2)

I've tried calling the setCompleted() function and also tried setting the instance value to its maxValue.

Am I "doing it wrong" or is this a bug?

function makePDFprogressBar(data) {
    pdfProgressBar = new ProgressBar({
        parent: pdfExportWindow,
        title: "Print to PDF",
        indeterminate: false,
        text: 'Print to PDF',
        detail: 'Preparing data...',
        maxValue: data.total,
        browserWindow: {
            closable: true
		}
    });

    pdfProgressBar
        .on('completed', function () {
            pdfProgressBar.detail = 'Task completed. Exiting...';
        })
        .on('aborted', function (value) {
            var opts = pdfProgressBar.getOptions()
            pdfProgressBar.value = opts.maxValue;
            
            pdfProgressBar.setCompleted();

            timelineWindow.webContents.send('message', { "event": "abort-PDF-export" });
            pdfProgressBar = null;
        })
        .on('progress', function (value) {
            pdfProgressBar.detail = `Page ${value} out of ${pdfProgressBar.getOptions().maxValue}...`;
        });
}

Using with Electron-updater

Hello,

I'm trying to get this to work with Electron updater, but can't get it to work. I was hoping you might have some suggestions. I have gotten it to work with the examples you provided, but not with the updater.

// updater.js
const {dialog, BrowserWindow, ipcMain} = require('electron');
const {autoUpdater} = require('electron-updater');
const ProgressBar = require('electron-progressbar');

// Enable logging
autoUpdater.logger = require('electron-log');
autoUpdater.logger.transports.file.level = 'info';

// Disable auto downloading
autoUpdater.autoDownload = false;

// Check for updates
exports.check = () => {
  // Start update check

  // autoUpdater.checkForUpdates();
  //
  // // Listen for download (update) found
  // autoUpdater.on('update-available', () => {
    // Promt user to update
    dialog.showMessageBox({
      type: 'info',
      title: 'Update Available',
      message: 'A new version is available.  Do you want to update now?',
      button: ['Update', 'No']
    }, (buttonIndex) => {

      // If not 'Update' button, return
      if (buttonIndex !== 0) return

      // Else start download and show download progress in new window
      autoUpdater.downloadUpdate();

      // Create progress window
      let progressWin = new ProgressBar({
        indeterminate: false,
        text: 'This will take a moment.',
        detail: 'Downloading',
        browserWindow: {
          webPreferences: {
            nodeIntegration: true
          }
        }
      });

      progressWin.on('completed', function () {
        console.info(`completed...`);
        progressWin.detail = 'Download complete!';
      })
          .on('aborted', function (value) {
            console.info(`aborted... ${value}`);
          })

      // Listen for progress request from progressWin
      ipcMain.on('download-progress-request', (e) => {
        console.log('download-progress-request', progressWin.value);
        e.returnValue = progressWin.value;
      });

      // Track download progress on autoUpdater
      autoUpdater.on('download-progress', (d) => {
        console.log('download-progress', d.percent);
        progressWin.value += d.percent * 100;
        progressWin.detail = `${progressWin.value} out of ${progressWin.getOptions().maxValue}...`;
      })

      // Listen for completed update download
      autoUpdater.on('update-downloaded', () => {
        console.log('update-download', progressWin.isCompleted());
        // Close progressWin
        if (progressWin && progressWin.isCompleted()) progressWin.setCompleted();

        // Promt user to quit and install update
        dialog.showMessageBox({
          type: 'info',
          title: 'Update Ready',
          message: 'A new version is ready. Quit and install now?',
          buttons: ['Yes', 'Later']
        }, (buttonIndex) => {

          // Update if 'Yes'
          if (buttonIndex === 0) autoUpdater.quitAndInstall();
        })
      })
    })
  // })
}

Any help would be appreciated.

Cannot read properties of null (reading 'classList')

	public ProgressBarIndefinitive(msg = 'Preparing data...', detail = 'Wait...'): any {
		const progressBar = new ProgressBar({
			text: msg,
			detail: detail,
		});

		progressBar
			.on('completed', () => {
				progressBar.detail = 'Task completed. Exiting...';
			})
			.on('aborted', (_value: number) => {
			});

		return progressBar;
	}

const progressbar = ProgressBarIndefinitive('Saving files');
void LocalFile.populateFolder();
progressbar.setCompleted();

I got this error:

"Uncaught TypeError: Cannot read properties of null (reading 'classList')", source: data:text/html;charset=UTF8,%0A%3C!DOCTYPE%20html%3E%0A%3Chtml%20%3E%0A%09%3Chead%3E%0A%09%09%3Cmeta%20charset%3D%22UTF-8%22%3E%0A%09%09%3Cstyle%3E%0A%09%09%09*%7B%0A%09%09%09%09margin%3A%200%3B%0A%09%09%09%09padding%3A%200%3B%0A%09%09%09%09box-sizing%3A%20border-box%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09body%7B%0A%09%09%09%09margin%3A%2020px%3B%0A%09%09%09%09margin-bottom%3A%200%3B%0A%09%09%09%09font%3A%2013px%20normal%20Verdana%2C%20Arial%2C%20%22sans-serif%22%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23text%7B%0A%09%09%09%09height%3A%2026px%3B%0A%09%09%09%09overflow%3A%20auto%3B%0A%09%09%09%09font-size%3A%2014px%3B%0A%09%09%09%09font-weight%3A%20bold%3B%0A%09%09%09%09padding%3A%205px%200%3B%0A%09%09%09%09word-break%3A%20break-all%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23detail%7B%0A%09%09%09%09height%3A%2040px%3B%0A%09%09%09%09margin%3A%205px%200%3B%0A%09%09%09%09padding%3A%205px%200%3B%0A%09%09%09%09word-break%3A%20break-all%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBarContainer%7B%0A%09%09%09%09text-align%3A%20center%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09progress%7B%0A%09%09%09%09-webkit-appearance%3A%20none%3B%0A%09%09%09%09appearance%3A%20none%3B%0A%09%09%09%09width%3A%20100%25%3B%0A%09%09%09%09height%3A%2025px%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09progress%3A%3A-webkit-progress-bar%7B%0A%09%09%09%09width%3A%20100%25%3B%0A%09%09%09%09box-shadow%3A%200%202px%205px%20rgba(0%2C%200%2C%200%2C%200.25)%20inset%3B%0A%09%09%09%09border-radius%3A%202px%3B%0A%09%09%09%09background%3A%20%23DEDEDE%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09progress%3A%3A-webkit-progress-value%7B%0A%09%09%09%09box-shadow%3A%200%202px%205px%20rgba(0%2C%200%2C%200%2C%200.25)%20inset%3B%0A%09%09%09%09border-radius%3A%202px%3B%0A%09%09%09%09background%3A%20%2322328C%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D%7B%0A%09%09%09%09overflow%3A%20hidden%3B%0A%09%09%09%09position%3A%20relative%3B%0A%09%09%09%09display%3A%20block%3B%0A%09%09%09%09margin%3A%200.5rem%200%201rem%200%3B%0A%09%09%09%09width%3A%20100%25%3B%0A%09%09%09%09height%3A%2010px%3B%0A%09%09%09%09border-radius%3A%202px%3B%0A%09%09%09%09background-color%3A%20%23DEDEDE%3B%0A%09%09%09%09background-clip%3A%20padding-box%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D%20%23progressBarValue%3A%3Abefore%7B%0A%09%09%09%09content%3A%20%22%22%3B%0A%09%09%09%09position%3A%20absolute%3B%0A%09%09%09%09top%3A%200%3B%0A%09%09%09%09bottom%3A%200%3B%0A%09%09%09%09left%3A%200%3B%0A%09%09%09%09will-change%3A%20left%2C%20right%3B%0A%09%09%09%09background%3A%20inherit%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D%20%23progressBarValue%3A%3Abefore%7B%0A%09%09%09%09-webkit-animation%3A%20indeterminate%202.1s%20cubic-bezier(0.65%2C%200.815%2C%200.735%2C%200.395)%20infinite%3B%0A%09%09%09%09animation%3A%20indeterminate%202.1s%20cubic-bezier(0.65%2C%200.815%2C%200.735%2C%200.395)%20infinite%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D%20%23progressBarValue%3A%3Aafter%7B%0A%09%09%09%09content%3A%20%22%22%3B%0A%09%09%09%09position%3A%20absolute%3B%0A%09%09%09%09top%3A%200%3B%0A%09%09%09%09bottom%3A%200%3B%0A%09%09%09%09left%3A%200%3B%0A%09%09%09%09will-change%3A%20left%2C%20right%3B%0A%09%09%09%09background%3A%20inherit%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D%20%23progressBarValue%3A%3Aafter%7B%0A%09%09%09%09-webkit-animation%3A%20indeterminate-short%202.1s%20cubic-bezier(0.165%2C%200.84%2C%200.44%2C%201)%20infinite%3B%0A%09%09%09%09animation%3A%20indeterminate-short%202.1s%20cubic-bezier(0.165%2C%200.84%2C%200.44%2C%201)%20infinite%3B%0A%09%09%09%09-webkit-animation-delay%3A%201.15s%3B%0A%09%09%09%09animation-delay%3A%201.15s%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D.completed%20%23progressBarValue%3A%3Abefore%2C%0A%09%09%09%23progressBar%5Bindeterminate%3D%22t%22%5D.completed%20%23progressBarValue%3A%3Aafter%7B%0A%09%09%09%09display%3A%20none%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09.completed%23progressBar%5Bindeterminate%3D%22t%22%5D%2C%0A%09%09%09.completed%23progressBar%5Bindeterminate%3D%22t%22%5D%20%23progressBarValue%7B%0A%09%09%09%09-webkit-transition%3A%200.5s%3B%0A%09%09%09%09transition%3A%200.5s%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%40-webkit-keyframes%20indeterminate%7B%0A%09%09%09%090%25%7B%20left%3A%20-35%25%3B%20right%3A%20100%25%3B%20%7D%0A%09%09%09%0960%25%7B%20left%3A%20100%25%3B%20right%3A%20-90%25%3B%20%7D%0A%09%09%09%09100%25%7B%20left%3A%20100%25%3B%20right%3A%20-90%25%3B%20%7D%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%40keyframes%20indeterminate%7B%0A%09%09%09%090%25%7B%20left%3A%20-35%25%3B%20right%3A%20100%25%3B%20%7D%0A%09%09%09%0960%25%7B%20left%3A%20100%25%3B%20right%3A%20-90%25%3B%20%7D%0A%09%09%09%09100%25%7B%20left%3A%20100%25%3B%20right%3A%20-90%25%3B%20%7D%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%40-webkit-keyframes%20indeterminate-short%7B%0A%09%09%09%090%25%7B%20left%3A%20-200%25%3B%20right%3A%20100%25%3B%20%7D%0A%09%09%09%0960%25%7B%20left%3A%20107%25%3B%20right%3A%20-8%25%3B%20%7D%0A%09%09%09%09100%25%7B%20left%3A%20107%25%3B%20right%3A%20-8%25%3B%20%7D%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09%40keyframes%20indeterminate-short%7B%0A%09%09%09%090%25%7B%20left%3A%20-200%25%3B%20right%3A%20100%25%3B%20%7D%0A%09%09%09%0960%25%7B%20left%3A%20107%25%3B%20right%3A%20-8%25%3B%20%7D%0A%09%09%09%09100%25%7B%20left%3A%20107%25%3B%20right%3A%20-8%25%3B%20%7D%0A%09%09%09%7D%0A%09%09%3C%2Fstyle%3E%0A%09%3C%2Fhead%3E%0A%09%3Cbody%3E%0A%09%09%3Cdiv%20id%3D%22text%22%3E%3C%2Fdiv%3E%0A%09%09%3Cdiv%20id%3D%22detail%22%3E%3C%2Fdiv%3E%0A%09%09%3Cdiv%20id%3D%22progressBarContainer%22%3E%3C%2Fdiv%3E%0A%09%09%3Cscript%3E%0A%09%09%09const%20%7B%20ipcRenderer%20%7D%20%3D%20require('electron')%3B%0A%09%09%09var%20currentValue%20%3D%20%7B%0A%09%09%09%09progress%20%3A%20null%2C%0A%09%09%09%09text%20%3A%20null%2C%0A%09%09%09%09detail%20%3A%20null%0A%09%09%09%7D%3B%0A%09%09%09%0A%09%09%09var%20elements%20%3D%20%7B%0A%09%09%09%09text%20%3A%20document.querySelector(%22%23text%22)%2C%0A%09%09%09%09detail%20%3A%20document.querySelector(%22%23detail%22)%2C%0A%09%09%09%09progressBarContainer%20%3A%20document.querySelector(%22%23progressBarContainer%22)%2C%0A%09%09%09%09progressBar%20%3A%20null%20%2F%2F%20set%20by%20createProgressBar()%0A%09%09%09%7D%3B%0A%09%09%09%0A%09%09%09function%20createProgressBar(settings)%7B%0A%09%09%09%09if(settings.indeterminate)%7B%0A%09%09%09%09%09var%20progressBar%20%3D%20document.createElement(%22div%22)%3B%0A%09%09%09%09%09progressBar.setAttribute(%22id%22%2C%20%22progressBar%22)%3B%0A%09%09%09%09%09progressBar.setAttribute(%22indeterminate%22%2C%20%22t%22)%3B%0A%09%09%09%09%09%0A%09%09%09%09%09var%20progressBarValue%20%3D%20document.createElement(%22div%22)%3B%0A%09%09%09%09%09progressBarValue.setAttribute(%22id%22%2C%20%22progressBarValue%22)%3B%0A%09%09%09%09%09progressBar.appendChild(progressBarValue)%3B%0A%09%09%09%09%09%0A%09%09%09%09%09elements.progressBar%20%3D%20progressBar%3B%0A%09%09%09%09%09elements.progressBarContainer.appendChild(elements.progressBar)%3B%0A%09%09%09%09%7Delse%7B%0A%09%09%09%09%09var%20progressBar%20%3D%20document.createElement(%22progress%22)%3B%0A%09%09%09%09%09progressBar.setAttribute(%22id%22%2C%20%22progressBar%22)%3B%0A%09%09%09%09%09progressBar.max%20%3D%20settings.maxValue%3B%0A%09%09%09%09%09%0A%09%09%09%09%09elements.progressBar%20%3D%20progressBar%3B%0A%09%09%09%09%09elements.progressBarContainer.appendChild(elements.progressBar)%3B%0A%09%09%09%09%7D%0A%09%09%09%09%0A%09%09%09%09window.requestAnimationFrame(synchronizeUi)%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09function%20synchronizeUi()%7B%0A%09%09%09%09elements.progressBar.value%20%3D%20currentValue.progress%3B%0A%09%09%09%09elements.text.innerHTML%20%3D%20currentValue.text%3B%0A%09%09%09%09elements.detail.innerHTML%20%3D%20currentValue.detail%3B%0A%09%09%09%09window.requestAnimationFrame(synchronizeUi)%3B%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09ipcRenderer.on(%22CREATE_PROGRESS_BAR%22%2C%20(event%2C%20settings)%20%3D%3E%20%7B%0A%09%09%09%09createProgressBar(settings)%3B%0A%09%09%09%7D)%3B%0A%09%09%09%0A%09%09%09ipcRenderer.on(%22SET_PROGRESS%22%2C%20(event%2C%20value)%20%3D%3E%20%7B%0A%09%09%09%09currentValue.progress%20%3D%20value%3B%0A%09%09%09%7D)%3B%0A%09%09%09%0A%09%09%09ipcRenderer.on(%22SET_COMPLETED%22%2C%20(event)%20%3D%3E%20%7B%0A%09%09%09%09elements.progressBar.classList.add('completed')%3B%0A%09%09%09%7D)%3B%0A%09%09%09%0A%09%09%09ipcRenderer.on(%22SET_TEXT%22%2C%20(event%2C%20value)%20%3D%3E%20%7B%0A%09%09%09%09currentValue.text%20%3D%20value%3B%0A%09%09%09%7D)%3B%0A%09%09%09%0A%09%09%09ipcRenderer.on(%22SET_DETAIL%22%2C%20(event%2C%20value)%20%3D%3E%20%7B%0A%09%09%09%09currentValue.detail%20%3D%20value%3B%0A%09%09%09%7D)%3B%0A%09%09%3C%2Fscript%3E%0A%09%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A (198)

Invalid call: trying to set value but the progress bar window is not active.

Hi guys, could someone help me?

I have this code in my render process

async function getData(parameter, printerCommand, numberOfIndex, type) {
  console.log(parameter)
  ipc.send(`${parameter}-progress-bar`, [numberOfIndex, type])

  let flagsLenght = 0;
  let data = []

  if (parameter == "keyboard") {
    for (i = 0; i <= numberOfIndex; i++) {
      if ((i + "").length < 2) {
        index = "00" + i
      } else if ((i + "").length < 3) {
        index = "0" + i
      } else {
        index = i.toString()+1
      }
      await getSingleFlagsPromise(index)
    }
  } else {
    for (i = 1; i < numberOfIndex + 1; i++) {
      if ((i + "").length < 2) {
        index = "0" + i
      } else {
        index = i.toString()
      }
      await getSingleFlagsPromise(index);
    }
  }

  function getSingleFlagsPromise(id) {

    return new Promise((resolve, reject) => {

      const protocol = store.configData["protocol"];
      const ipAddress = store.configData["ipAddress"];
      const xmlHTTPRequestURLMain = `${protocol}${ipAddress}/cgi-bin/fpmate.cgi`;
      const dataCommand = `<printerCommand> <directIO command="${printerCommand}" data="${id}" /> </printerCommand>`;
      const epos = new epson.fiscalPrint();

      epos.onreceive = (result, tag_names_array, add_info, res_add) => {
        if (result.success) {
          data.push(add_info.responseData)
          flagsLenght++
          ipc.send('set-value', (flagsLenght))
          console.log(`${parameter} --> ${index} --> ${add_info.responseData}`)
          resolve(data)
          //flagsBar.animate(FlagsLenght/getIndexFromFirmware()[0]);
        }
      };
      epos.onerror = (result) => {
        if (!result.success) {
          console.log(result)
          reject(result)
        }
      };
      epos.send(xmlHTTPRequestURLMain, dataCommand, 200000, false);
    });
  }
  return Promise.resolve(data)
}

which when called sends ipc.send ($ {parameter} -progress-bar, [numberOfIndex, type]) to the main process.

in the main process i've this code:

ipcMain.on('flags-progress-bar', function (event, arg) {

  var progressBar = new ProgressBar({
    maxValue: arg[0]-1,
    browserWindow: {
      closable: true,
      webPreferences: {
        nodeIntegration: true
      }
    },
    closable : true,
    indeterminate: false,
    text: `${arg[1]} dati in corso...`,
    detail: 'Attendere...',
    style: { // the keys are all elements of the progress bar
			text: { // pair of CSSS properties/values
				'font-weight': 'bold',
				'color': '#000000'
			},
			detail: {
				'color': '#3F51B5'
			},
			bar: {
				'background': '#80BDFF'
			},
			value: {
				'background': '#007BFF'
			}
		},
  });
  progressBar
    .on('completed', function () {
      console.info(`completed...`);
      progressBar.detail = 'Task completata...';
    })

    .on('aborted', function (value) {
      console.info(`aborted... ${value}`);
    })

    .on('progress', function (value) {
      progressBar.detail = `${arg[1]} S14 | Chiave ${value +1} di ${progressBar.getOptions().maxValue+1}...`;
    });

  ipcMain.on("set-value", (event, arg) => {
    progressBar.value = parseFloat(arg)
  });
});

that when it receives ipcMain.on ("set-value") coming from the render process it updates the value of the progress bar, everything works, but that error appears in the electron console, how can I solve?
I hope I was clear

Riccardo

Browser window is not a constructor

Hello, might just be me and my lack of electron knowledge but I am trying to fire a progress bar on the click of a button.

Passing in the app or not I get

"Browser window is not a constructor"

Can you help me with an example firing the progress bar on a click event?

As all the examples just show it when the app loads

Whole Script stops after bar is completed

Hi. Im using this Module with TouchPortal API and after the Progressbar completed the plugin goes further until The TouchPortal API connected. then the Script just stops. if i disable the bar it works again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.