SOLFIND
Web Lens
Portal home

Progress Bars | Electron

https://www.electronjs.org/de/docs/latest/tutorial/progress-bar • 67 KB fetched
Open original page


Progress Bars | Electron Zum Hauptteil springen Electron Dokumentation API Blog Tools * Electron Forge * Elektro-Fiddle Community * Kontrolle * Showcase * Ressourcen Veröffentlichungen Deutsch * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Suche * Loslegen * Prozesse in Electron * Bewährte Verfahren * Beispiele * Nachtmodus * Device Access * In-App Purchases * * Tastenkürzel * Deep Links * Desktop Launcher Actions * * Menus * Multithreading * Natives Datei Drag & Drop * Navigationsverlauf * Benachrichtigungen * Offscreen Rendering * Online/Offline Ereigniserkennung * Progress Bars * Kürzliche Dokumente * * * Darstellung von Dateien in einem BrowserWindow * * Rechtschreibprüfung * Web Embeds * Taskbar Customization * * Window Customization * Entwicklung * Native Node Modules * Distribution * Testen und Debuggen * References * Beitragen * * Beispiele * Progress Bars Auf dieser Seite Progress Bars Übersicht ​ A progress bar enables a window to provide progress information to the user without the need of switching to the window itself. On Windows, you can use a taskbar button to display a progress bar. On macOS, the progress bar will be displayed as a part of the dock icon. On Linux, the Unity graphical interface also has a similar feature that allows you to specify the progress bar in the launcher. NOTE: on Windows, each window can have its own progress bar, whereas on macOS and Linux (Unity) there can be only one progress bar for the application. All three cases are covered by the same API - the setProgressBar() method available on an instance of BrowserWindow . To indicate your progress, call this method with a number between 0 and 1 . For example, if you have a long-running task that is currently at 63% towards completion, you would call it as setProgressBar(0.63) . Setting the parameter to negative values (e.g. -1 ) will remove the progress bar. Setting it to a value greater than 1 will indicate an indeterminate progress bar in Windows or clamp to 100% in other operating systems. An indeterminate progress bar remains active but does not show an actual percentage, and is used for situations when you do not know how long an operation will take to complete. See the API documentation for more options and modes . Beispiel ​ In this example, we add a progress bar to the main window that increments over time using Node.js timers. docs/fiddles/features/progress-bar ( 43.4.0 ) Open in Fiddle * main.js * index.html const { app , BrowserWindow } = require ( 'electron/main' ) let progressInterval function createWindow ( ) { const win = new BrowserWindow ( { width : 800 , height : 600 } ) win . loadFile ( 'index.html' ) const INCREMENT = 0.03 const INTERVAL_DELAY = 100 // ms let c = 0 progressInterval = setInterval ( ( ) => { // update progress bar to next value // values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100% win . setProgressBar ( c ) // increment or reset progress bar if ( c < 2 ) { c += INCREMENT } else { c = ( - INCREMENT * 5 ) // reset to a bit less than 0 to show reset state } } , INTERVAL_DELAY ) } app . whenReady ( ) . then ( createWindow ) // before the app is terminated, clear both timers app . on ( 'before-quit' , ( ) => { clearInterval ( progressInterval ) } ) app . on ( 'window-all-closed' , ( ) => { if ( process . platform !== 'darwin' ) { app . quit ( ) } } ) app . on ( 'activate' , ( ) => { if ( BrowserWindow . getAllWindows ( ) . length === 0 ) { createWindow ( ) } } ) <! DOCTYPE html > < html > < head > < meta charset = " UTF-8 " > < title > Hello World! </ title > < meta http-equiv = " Content-Security-Policy " content = " script-src 'self' 'unsafe-inline'; " /> </ head > < body > < h1 > Hello World! </ h1 > < p > Keep an eye on the dock (Mac) or taskbar (Windows, Unity) for this application! </ p > < p > It should indicate a progress that advances from 0 to 100%. </ p > < p > It should then show indeterminate (Windows) or pin at 100% (other operating systems) briefly and then loop. </ p > </ body > </ html > After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity) should show a progress bar that starts at zero and progresses through 100% to completion. It should then show indeterminate (Windows) or pin to 100% (other operating systems) briefly and then loop. For macOS, the progress bar will also be indicated for your application when using Mission Control : Diese Seite bearbeiten Vorherige Online/Offline Ereigniserkennung Nächste Kürzliche Dokumente * Übersicht * Beispiel Dokumentation * Erste Schritte * API-Referenz Checklisten * Performance * Sicherheit Tools * Electron Forge * Elektro-Fiddle Community * Kontrolle * Ressourcen * Discord * Bluesky * X * Mastodon * Stack Overflow Mehr * GitHub * Open Collective * Infrastruktur Dashboard Copyright OpenJS Foundation und Electron Mitwirkenden. Alle Rechte vorbehalten. Die OpenJS Foundation hat eingetragene Marken und verwendet Marken. Für eine Liste der Marken der OpenJS Foundation , lesen Sie bitte unsere Markenrichtlinie und Markenliste . Marken und Logos nicht auf der Liste der Marken der OpenJS Foundation sind Marken™ oder eingetragene® Marken ihrer jeweiligen Inhaber. Der Gebrauch von ihnen impliziert keine Zugehörigkeit oder Zustimmung von ihnen. Die OpenJS Foundation | Nutzungsbedingungen | Datenschutzrichtlinie | Satzung | | | Markenrichtlinie | Markenliste | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. Zum Hauptteil springen [direct]
  2. Electron [direct]
  3. Dokumentation [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Elektro-Fiddle [direct]
  8. Kontrolle [direct]
  9. Showcase [direct]
  10. Ressourcen [direct]
  11. Veröffentlichungen [direct]
  12. English [direct]
  13. Español [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. Prozesse in Electron [direct]
  20. Bewährte Verfahren [direct]
  21. Beispiele [direct]
  22. Nachtmodus [direct]
  23. Device Access [direct]
  24. In-App Purchases [direct]
  25. Tastenkürzel [direct]
  26. Deep Links [direct]
  27. Desktop Launcher Actions [direct]
  28. Menus [direct]
  29. Multithreading [direct]
  30. Natives Datei Drag & Drop [direct]
  31. Navigationsverlauf [direct]
  32. Benachrichtigungen [direct]
  33. Offscreen Rendering [direct]
  34. Online/Offline Ereigniserkennung [direct]
  35. Kürzliche Dokumente [direct]
  36. Darstellung von Dateien in einem BrowserWindow [direct]
  37. Rechtschreibprüfung [direct]
  38. Web Embeds [direct]
  39. Taskbar Customization [direct]
  40. Window Customization [direct]
  41. Entwicklung [direct]
  42. Native Node Modules [direct]
  43. Distribution [direct]
  44. Testen und Debuggen [direct]
  45. References [direct]
  46. Beitragen [direct]
  47. setProgressBar() [direct]
  48. docs/fiddles/features/progress-bar ( 43.4.0 ) [direct]
  49. Open in Fiddle [direct]
  50. Mission Control [direct]
  51. Diese Seite bearbeiten [direct]
  52. Sicherheit [direct]
  53. Discord [direct]
  54. Bluesky [direct]
  55. X [direct]
  56. Mastodon [direct]
  57. Stack Overflow [direct]
  58. GitHub [direct]
  59. Open Collective [direct]
  60. Infrastruktur Dashboard [direct]
  61. OpenJS Foundation [direct]
  62. Markenrichtlinie [direct]
  63. Markenliste [direct]
  64. Nutzungsbedingungen [direct]
  65. Datenschutzrichtlinie [direct]
  66. Satzung [direct]
  67. | [direct]
  68. Cookie Policy [direct]