Fireship · @fireship
Electron JS in 100 Seconds
Uploaded February 26, 2020 · Length 1:49
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.
- 0:00
electrons build native desktop apps for
- 0:02
platforms like Mac OS and Windows using
- 0:04
nothing but HTML CSS and JavaScript it's
- 0:07
a tool behind many popular apps that you
- 0:09
might be using today like the s code
- 0:10
slack and discord just to name a few on
- 0:13
the front end you build UIs just like
- 0:14
you would for a browser-based web app
- 0:16
and you can bring along to our favorite
- 0:17
frameworks but an electron you also have
- 0:19
access to note J s and that means you
- 0:21
can access low-level API s that you
- 0:23
don't normally have access to in a
- 0:25
sandbox browser like the file system
- 0:27
electron combines the front end and back
- 0:28
end technologies and provides a bunch of
- 0:30
other tools to work with native menus
- 0:32
the system tray and so on
- 0:33
let's go ahead and build a desktop app
- 0:35
now run NPM in it in an empty directory
- 0:37
and install electron then create a
- 0:39
main.js file and set that as the main
- 0:41
entry point into your app every electron
- 0:43
app has exactly one main process running
- 0:45
it manages the lifecycle of your app and
- 0:48
opens the windows that the end user will
- 0:49
see each window is its own independent
- 0:52
render process running with the chromium
- 0:53
web browser when your main app is ready
- 0:55
you can start a new render process by
- 0:57
instantiating a browser window until the
- 0:59
window to load a regular HTML file it
- 1:02
will render the HTML CSS and JavaScript
- 1:04
but do so in a native window and give
- 1:06
you access to low-level api is to build
- 1:08
a true desktop experience create an
- 1:10
index.html file and put whatever code
- 1:12
you want inside of it but notice how i'm
- 1:14
accessing note Global's directly in my
- 1:15
HTML that's not something you can do in
- 1:17
a normal web browser an electron gives
- 1:19
you control over the operating system UI
- 1:21
as well for example add your own icon
- 1:23
and controls to the system tray with
- 1:25
just a few lines of code now after you
- 1:27
build something awesome you can package
- 1:28
it for multiple operating systems from a
- 1:31
single codebase tools like electron
- 1:32
packager or forage can handle the entire
- 1:34
distribution process for you with a
- 1:36
single command this has been electron in
- 1:38
100 seconds stay tuned for a full
- 1:40
electron project in a few days and make
- 1:42
sure to hit the like button if you want
- 1:43
to see more short videos like this
- 1:45
thanks for watching and I will see you
- 1:47
in the next one
- 1:48
[Music]


