Fireship · @fireship

Electron JS in 100 Seconds

Uploaded February 26, 2020 · Length 1:49

Electron JS in 100 Seconds

Summary

electron js tutorial for building native desktop apps with html css and js

  • electron js
  • native desktop apps
  • html css js
  • desktop application development

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    electrons build native desktop apps for

  2. 0:02

    platforms like Mac OS and Windows using

  3. 0:04

    nothing but HTML CSS and JavaScript it's

  4. 0:07

    a tool behind many popular apps that you

  5. 0:09

    might be using today like the s code

  6. 0:10

    slack and discord just to name a few on

  7. 0:13

    the front end you build UIs just like

  8. 0:14

    you would for a browser-based web app

  9. 0:16

    and you can bring along to our favorite

  10. 0:17

    frameworks but an electron you also have

  11. 0:19

    access to note J s and that means you

  12. 0:21

    can access low-level API s that you

  13. 0:23

    don't normally have access to in a

  14. 0:25

    sandbox browser like the file system

  15. 0:27

    electron combines the front end and back

  16. 0:28

    end technologies and provides a bunch of

  17. 0:30

    other tools to work with native menus

  18. 0:32

    the system tray and so on

  19. 0:33

    let's go ahead and build a desktop app

  20. 0:35

    now run NPM in it in an empty directory

  21. 0:37

    and install electron then create a

  22. 0:39

    main.js file and set that as the main

  23. 0:41

    entry point into your app every electron

  24. 0:43

    app has exactly one main process running

  25. 0:45

    it manages the lifecycle of your app and

  26. 0:48

    opens the windows that the end user will

  27. 0:49

    see each window is its own independent

  28. 0:52

    render process running with the chromium

  29. 0:53

    web browser when your main app is ready

  30. 0:55

    you can start a new render process by

  31. 0:57

    instantiating a browser window until the

  32. 0:59

    window to load a regular HTML file it

  33. 1:02

    will render the HTML CSS and JavaScript

  34. 1:04

    but do so in a native window and give

  35. 1:06

    you access to low-level api is to build

  36. 1:08

    a true desktop experience create an

  37. 1:10

    index.html file and put whatever code

  38. 1:12

    you want inside of it but notice how i'm

  39. 1:14

    accessing note Global's directly in my

  40. 1:15

    HTML that's not something you can do in

  41. 1:17

    a normal web browser an electron gives

  42. 1:19

    you control over the operating system UI

  43. 1:21

    as well for example add your own icon

  44. 1:23

    and controls to the system tray with

  45. 1:25

    just a few lines of code now after you

  46. 1:27

    build something awesome you can package

  47. 1:28

    it for multiple operating systems from a

  48. 1:31

    single codebase tools like electron

  49. 1:32

    packager or forage can handle the entire

  50. 1:34

    distribution process for you with a

  51. 1:36

    single command this has been electron in

  52. 1:38

    100 seconds stay tuned for a full

  53. 1:40

    electron project in a few days and make

  54. 1:42

    sure to hit the like button if you want

  55. 1:43

    to see more short videos like this

  56. 1:45

    thanks for watching and I will see you

  57. 1:47

    in the next one

  58. 1:48

    [Music]