Build an Electron App in Under 60 Minutes

Поделиться
HTML-код
  • Опубликовано: 6 окт 2024
  • НаукаНаука

Комментарии • 873

  • @mac8867
    @mac8867 5 лет назад +363

    Thanks Brad, this is really great work. Using electron v5 here, the BrowserWindow calls need to include webPreferences: {nodeIntegration: true} now, otherwise the electron functions are not available in the html pages. (ie.: “Uncaught ReferenceError: require is not defined”)
    // Create new main window
    mainWindow = new BrowserWindow(
    {
    webPreferences: {
    nodeIntegration: true
    }
    }
    );

    • @parsonsmarcus
      @parsonsmarcus 5 лет назад +32

      This same preference has to be set in the creation of the addWindow in order for "require" to work correctly. Thanks, Robb!

    • @willhamilton9042
      @willhamilton9042 5 лет назад +3

      Thanks!!!

    • @israellucena926
      @israellucena926 5 лет назад +46

      "addWindow = new BrowserWindow({
      width: 300,
      height: 200,
      title: 'Add Shopping List Item',
      webPreferences: {nodeIntegration: true}
      });"

    • @__VAL__
      @__VAL__ 5 лет назад +1

      @@israellucena926 Thank you

    • @r2_rho
      @r2_rho 5 лет назад +1

      This was incredibly helpful, thank you Robb!

  • @jasonacheampong8748
    @jasonacheampong8748 5 лет назад +20

    This is one of the best coding tutorials I have ever seen PERIOD. He explains the topic very well and prevents any confusion.

    • @brains4043
      @brains4043 2 года назад

      on these simple ones, basically he's just using official documentation. but yea, sometimes i fount better to listen some things

  • @mattural20
    @mattural20 5 лет назад +14

    There’s something about how you go through these tutorials that makes stuff I struggle to get all the time clear as a bell. Fantastic work. Many thanks.

  • @BeastieKarlbovsky
    @BeastieKarlbovsky 7 лет назад +38

    As always the first thing I want to say is: "Thank you, Brad ! ". It would be awesome to continue with this tutorial by adding more functionalities to the app, like saving our list to a JSON file (locally), retrieving saved JSON lists(locally), upload them to some kind of web-server, download resources from the web, etc...

    • @sync3217
      @sync3217 6 лет назад +1

      I was thinking about the same thing too. And if we publish the app it will be good using MongoDB or SQL dbs

    • @Altanis1
      @Altanis1 5 лет назад +1

      fs.writeFile('./file.json', JSON.stringify(whatever_the_input_was), err => {
      if (err) throw err;
      // Successfully written to file
      }

  • @davidaffran7447
    @davidaffran7447 5 лет назад +6

    Dude, I've listened to a few teachers on youtube and you really do a great job. no fluff just simple, clear communication. Appreciate your work. Thanks Brad :)

  • @ErnestGWilsonII
    @ErnestGWilsonII 7 лет назад +273

    Damn you Brad! I can't stop watching your videos! I have no idea where you find the time to make these videos I barely have the time to power watch them! The funny thing is I think my wife thinks we have the Traversy media channel on TV! I watch most of your videos on the Chromecast on a very large screen in total comfort and I really enjoy your content. As I sit here watching a yet another great video I am certain that my next trip in front of the computer I will indeed sign up for your Patreon and help support your channel and thank you for all the great work that you do!

    • @TraversyMedia
      @TraversyMedia  7 лет назад +41

      LOL that is awesome. TV channel, that would be nice :)

    • @javierpacareu
      @javierpacareu 6 лет назад +3

      Bend the knee in front of your god Traversy

    • @muhammadfarooqi
      @muhammadfarooqi 3 года назад

      Have you every tried too? brow!!!!

  • @shooorov
    @shooorov 3 года назад +6

    if you're using 'electron >= version 12'
    use
    new BrowserWindow({
    webPreferences:{
    nodeIntegration:true,
    contextIsolation: false
    }
    });

    • @ozgunsenyuva
      @ozgunsenyuva 2 года назад

      Thank you, this was what I am looking for.

  • @MicroCheese64
    @MicroCheese64 2 года назад

    I like the way this tutorial was done. Dude just seems like a chill, informative dude and he doesn't talk like a robot. Good stuff.

  • @Zeghabioussama
    @Zeghabioussama 3 года назад +13

    i faced a problem when i write const electron = require('electron') in script tag

  • @mahakileach9223
    @mahakileach9223 5 лет назад

    WOW.. just wow i've been using electron now for about a year and yet i still come back to this video every couple of days when i forget how to do something. thank you

  • @dericbytes
    @dericbytes 5 лет назад +1

    Great to see how simple it is to use Electron if you now of to build webpages. Thanks for letting me see how you work.

  • @static2601
    @static2601 6 лет назад

    This was a really good tutorial. I spent hours trying to understand and build an app with little understanding, this tutorial was extremely helpful in getting my app from start to finish. I built my app as he went along. Now finished with the first version, built and shipped. Really good way of teaching, I hope to watch more from him

  • @mitlandir5761
    @mitlandir5761 6 лет назад +2

    I must say, I watch a few online guides on various JS-related stuff and yours are by far my favorite! I love it how you pace your guides in a way that is not slow, but also not too fast to type/think along! Keep up the good work!

  • @ErikSjaastad
    @ErikSjaastad 6 лет назад +13

    So glad this was my intro to Electron! Saturday morning well spent!

  • @Fanoflix
    @Fanoflix 3 года назад

    At 38:30. If you don't quite understand it, here's a shorter way of doing it that does the exact same thing. And its easier to understand.
    const li = document.createElement('li');
    li.innerHTML = item
    ul.appendChild(li)
    Thats it.
    You just created a li HTML tag, put item into it (which translates to item in HTML) and then append the to the .
    What he does is the exact same thing, but just 1 line longer lol XD

  • @l.b.7114
    @l.b.7114 7 лет назад +14

    Before I saw this video, I didn't even know that a desktop application can be made with Javascript. Thank you for that.
    I applaud your skills and looking forward to more of your videos.
    Subbed

  • @travisbarton4288
    @travisbarton4288 4 года назад

    OMFG the BEST!
    I started learning electron last weekend, a couple tutorials and MANY documentations later I had little to show for it.
    One day working with this tutorial and I have a complete app and MUCH better understanding of the frameworks. Thank you!!

  • @KellenChase
    @KellenChase 4 года назад

    ... I probably shouldn't be this excited, but I have written my first electron application and it feels great! going to look into this best way to add persistence of data for an app like this, and then I am going to tackle making a personal finance app with this as a start in that journey. thank you so much!

  • @bank_coder
    @bank_coder 7 лет назад

    Best Instructor Alive ..... Your Passion Makes Us To Easily Fulfill And Follow Our Dreams ! Thanks Brad

  • @davidconnelly
    @davidconnelly 7 лет назад

    The volume and quality of work that you're producing is staggering! My mind is blown.

  • @akashdalvi5419
    @akashdalvi5419 3 года назад

    Thanks Brad this really helped me a lot. Just for people coming here, using electron v9 you can just do "mainWindow.loadfile('fileName')" instead of all the joining strings thing.

  • @tempez1918
    @tempez1918 5 лет назад

    Thank you dude! This is the only tutorial that showed how to actually change the icon of an electron app I checked like 2 or 3 pages from Google and used a few weeks to figure this out: life saver!! Good Work, keep it up!

  • @SRG-Learn-Code
    @SRG-Learn-Code 6 лет назад +1

    Thank you very much, great lesson well explained. It took me 2 hours and a half to complete the tutorial but I've never use electron, git bash and even javascript for a purpouse. Glad I've found this resource.

  • @lukehero
    @lukehero 6 лет назад

    Amazing! I just learnt everything necessary from this one video. Went from not knowing anything about it to building my complete app. Thank you!

  • @amrullokhuja
    @amrullokhuja 7 лет назад +2

    Thanks for the content Brad. I just noticed that addWindow will opened no matter if there is one already open.
    Just check if addWindow is defined and focus it.
    Under click event on Add item:
    if (addWindow) {
    addWindow.focus();
    } else {
    createAddWindow();
    }

  • @khanhsb15
    @khanhsb15 2 года назад

    Thanks Brad. The lesson is very short and easy to understand so that I can easily access the electron app

  • @maxeminem777
    @maxeminem777 7 лет назад

    I think that Electron tutorials would be a great idea for your channel, lots of people, including me are looking for some high quality tutorials on Electron, especially from a person like you, your way of teaching is really effective. Thanks for awesome videos, keep making them :)

  • @das_evoli
    @das_evoli 2 года назад

    I'm shocked how easy this is. Thank you for this presentation

  • @SetszawA
    @SetszawA 2 года назад

    Such great video, you man are the real MVP. This video from 5 years ago is more helpful than any other updated Electron tutorial I could find.

  • @pembatamang8233
    @pembatamang8233 4 года назад

    great work man. I am an android dev with some exp with js. Just started electron today and this tutorial went smooth af thanks!!

  • @raghav9o9
    @raghav9o9 5 лет назад +4

    Thanks I watched whole tutorial but I didn't understand it fully. So, I think I have to take some tutorial but your tutorial is very amazing. Pls make more stuff like this.
    Thanks Brad

  • @Ur_Local_Leia
    @Ur_Local_Leia 6 лет назад

    I have been watch alot of diffrent types of videos and i have to say that, this is the best one yet. I understand the code and thats great. Thanx for taking your time to do this.

  • @naveenraina3145
    @naveenraina3145 4 года назад

    Wow. This is the first electron video that gave me so much insight of electronjs. Great work.

  • @svetoslavasenov5609
    @svetoslavasenov5609 7 лет назад

    This is the best electron tutorial I have seen. Can't wait for the next one with the database access.

  • @danielk.3017
    @danielk.3017 5 лет назад

    Thanks for the video, I'm a student application developer, I only know how to make websites so far, having electron as a tool and someone who explains me on how to use it, is nice indeed.

  • @muhammadaousaja6732
    @muhammadaousaja6732 5 лет назад

    Hello dear sir Brad, My name is Zed, I am Currently a software engineering student and I learned a lot form your videos, I highly appreciates your efforts for students like us, I highly look up to you, I respect you a lot, you are the best teacher on You-tube.
    I have a few questions for you and I hope you will answer my questions.
    Question Number 1) How can we create Sign-Up and Log-In forms using electron in a desktop application?
    Question Number 2) How can we create Admin, Staff (Dashboard) using electron in a desktop application?
    Question Number 3) How can we create an (A.I. Chat bot) using electron in a desktop application, which will interact wit the humans of real world, talk to the humans, ask questions like (what is your name sir?), and save all of the information that it gets from the real world and store it in it's database, and also be able to greet the humans of real world when application starts like (Welcome respected Sir, How may I assist you) ?
    Respected Sir Brad these were my questions for you, I hope you will help me out, I need your assistance in solving these questions, I will be highly thank full to you for your help for the rest of my life.
    Thank you very much
    I really like your videos a lot
    You are the best.

  • @daniellujan9129
    @daniellujan9129 5 лет назад +2

    If you get a 'require is not defined error', add this - webPreferences: {nodeIntegration: true} - inside 'mainWindow' in the main.js file. They changed nodeIntegration to false recently for security reasons. This fixes it just do your research though.

  • @AntonioRibeiro-qs3fy
    @AntonioRibeiro-qs3fy 6 лет назад +1

    Thanks Mr. Traversy and Traversy Media...I just want to say if anyone is having trouble with a errno 1 / elifecycle error be sure to globalize the electron software by running npm install -g electron-packager in the command prompt

  • @leomacherla
    @leomacherla 3 года назад +4

    For anyone getting errors at 39:53, in the Clear Items click event, remove the .webContents from mainWindow.webContents.send('item:clear')

  • @josepservat211
    @josepservat211 4 года назад +5

    Even in 2019, this is still a great tutorial :)

  • @SethuSenthil
    @SethuSenthil 7 лет назад +13

    This guy always knows what i'm planning to learn next! Like how?!!

    • @samdavidpaul
      @samdavidpaul 5 лет назад

      Because we computer engineers walk through the same route.

  • @WtfBronson
    @WtfBronson 5 лет назад

    Dude..you are amazing.. after spending and refunding $30 on udemy courses and couldn't learn anything..
    You dove right into creating simple app that people can slowly build onto if they wanted to, and now it has made it much easier for me to understand JavaScript. although, I replaced everything in this video with TypeScript since i'm coming from a C# background ;)
    I cannot thank you enough,
    Cheers!

  • @amey7064
    @amey7064 5 лет назад

    Question: If I am adding a event listener for 'dblclick' on which is the list container, how does JavaScript know element to remove?

    • @annekinmeyburgh8797
      @annekinmeyburgh8797 5 лет назад +1

      e.target is a reference to the li that set off the eventlistener(the element that you double clicked), then with .remove() it removes the element it references, i.e. the li.

  • @achuziachristopher4432
    @achuziachristopher4432 4 года назад

    Enrolled for your electron course on udemy. You are the very best Brad, You are awesome

  • @Token-p1s
    @Token-p1s 6 лет назад

    for update reference, Electron enables menu items with "role". See documentation for insight on it, but role: quit would add a menu item with quit

  • @shishirkumarsky
    @shishirkumarsky 7 лет назад

    This tutorials should be must watch. I followed this tutorial in linux(Ubuntu 16.04), everything works fine!

  • @dougiehawes916
    @dougiehawes916 4 года назад

    Crash learning electron for an upcoming interview. This is just what I need.

  • @emanuelmateusinacio2850
    @emanuelmateusinacio2850 6 лет назад +1

    Thanks for this video. This is one of the best tutorials I've ever found. The amount of valuable knowledge I got from this video is amazing. I can't even believe how you were able to come up with such a project that teaches a lot in under an hour. Will definitely subscribe and become a patron. Thanks a lot and keep up with your great tutorials!

  • @zone66
    @zone66 4 года назад +1

    this is my first programmers-youtube-channel abonnement :) such a fun tutorial, was nice to follow up.

  • @kapilpatel9379
    @kapilpatel9379 6 лет назад

    very nicely described, I recommend this to anyone new with electron

  • @BrunoMateusvvp
    @BrunoMateusvvp 6 лет назад +2

    Awesome tutorial, and I learned much more about electron in this vid than reading electrons' docs. Thanks!

  • @mhdz10
    @mhdz10 6 лет назад

    Dude you really have a natural talent to explain things. Thanks! =)

  • @1045geo
    @1045geo 5 лет назад

    Hey man. Thank you. The more videos you do the better we become. We want practical examples (as you already do), maybe something related to DB. Thank you once again. You are great!

  • @sebastianiuga3020
    @sebastianiuga3020 4 года назад +6

    For those getting the require error, pass webPreferences: {nodeIntregation: true} when creating windows.
    Aaaaand, shortcuts are made for a reason, use them! Can't click 4 times to make a folder :D

  • @pcgs_
    @pcgs_ 7 лет назад

    Brad, you're the best, really!!! I'm learning so much with your tutorials. Congratulations!

  • @muneebahmad8772
    @muneebahmad8772 2 года назад +1

    electron is very handy and good for desktop applications thank you sir & always thumbs up for Traversy media

  • @JD-hq1kn
    @JD-hq1kn 5 лет назад

    Brad... Your channel is one of the best thing I discovered in my life

  • @PineappleQuesadillas
    @PineappleQuesadillas 4 года назад

    Fantastic tutorial! Especially loved the attention to detail and getting the small stuff right.

  • @AmienPhillips
    @AmienPhillips 6 лет назад

    This is brilliant thank you!
    I accidentally spent an hour watching it without even intending to

  • @1tuan1
    @1tuan1 7 лет назад

    wow, this Electron tutorial is one of the best i have ever seen!. I hope you will post more of this and maybe Electron with Sql/Sqlite.
    great work!

  • @luismelo4131
    @luismelo4131 6 лет назад +1

    this tutorial was very helpful for me since i had no idea how to properly package an app and i was wondering if you could make a tutorial about how to package the app for the windows store:D

  • @LeoPacheco87
    @LeoPacheco87 5 лет назад

    Thanks, Brad! Another great video! Right now im trying to become a full stack js developer and your content helped me with almost all i needed! THANK YOU!

  • @KoDesign0
    @KoDesign0 4 года назад

    Thank you so much, this really helped me out to begin production. Easy and straight forward. Wish i could like a video twice!

  • @the2cguy
    @the2cguy 2 года назад +3

    If you still get an error "require is not defined" even with nodeIntegration, use :
    webPreferences: {
    nodeIntegration: true,
    contextIsolation: false
    }

  • @TheSweatCatcher09
    @TheSweatCatcher09 2 года назад

    Thank you for the detailed tutorial, helped me a lot a novice on electron..

  • @Noisecooore
    @Noisecooore 6 лет назад

    Thanks , great video. One suggestion, maybe explain object destructuring once at the start and save time on the rest of the video by doing (eg at 29:55)
    const {ipcRenderer} = require('electron')

  • @TitoMitto
    @TitoMitto 7 лет назад

    Brad I love your detailed tutorials.Can you please make a tutorial of how to integrate electron with Angular 4 instead of just vanilla JavaScript

  • @sebaperalta2001
    @sebaperalta2001 4 года назад

    This is absolutely beautiful! Congrats on your success! Obviously suscribed!
    Can you do a tutorial port of this app in React Native for mobile? I'm sure there are plenty of other people that would like to see it

  • @barryjohnson2756
    @barryjohnson2756 7 лет назад

    Microsoft released a 64 bit version of visual studio code. and it's awesome. i encourage everyone to use it. what i like about visual studio code is the built in console so you don't have to switch between windows or split screen because not everyone has a big screen. i like sublime text because it's very lightweight unlike atom.

  • @fleischer444
    @fleischer444 5 лет назад +16

    What keyboard do you use? Love the sound!!

    • @wondercreator8244
      @wondercreator8244 3 года назад

      I think mechanical keyboard

    • @dotnet9830
      @dotnet9830 3 года назад

      @@wondercreator8244 think he meant switches

  • @sahandjavid8755
    @sahandjavid8755 4 года назад

    Thank you for this. Explaining important stuff through simple example, that was just perfect.

  • @nitishdhiman6616
    @nitishdhiman6616 5 лет назад

    Hey Brad, Thanks for this tutorial man. It's been a while I've been following you and you really are the mentor every Web Developer needs. Could you please do a tutorial on Electron and help us add Database to it and maybe explain some concepts such as Updating the app and etc. Really keen to learn more about the Electron.
    Love From India.

  • @neilguylindberg6672
    @neilguylindberg6672 4 года назад

    Sorry for so many comments, but I also learned I need this in BOTH instantiations of "new BrowserWindow" for "require" to work in script tags:
    webPreferences: {
    nodeIntegration: true // allows access to 'process' of node, and use of 'require'
    }

  • @firelordkushroll
    @firelordkushroll 5 лет назад

    this is good shizzle. thank you for this video. got a foundation made, fully working, and with bootstrap. many thanks /bow

  • @Mrnonamsss
    @Mrnonamsss 7 лет назад

    When i begin working my first work is check out your patreon
    Big thanks for great contents. I really like your style keep it up.

  • @BlackEyedPeas0078
    @BlackEyedPeas0078 6 лет назад

    This reminds me of a programming language in DOS called Clipper by Computer Associates, which I used for a long time until Visual Basic 3.0 came out. in the 90s it simulated object-oriented programming using arrays.

  • @rickelmonoggin
    @rickelmonoggin 4 года назад

    Very useful for getting started with Electron.

  • @rupeshchandramohanty416
    @rupeshchandramohanty416 3 года назад

    Thank you for this amazing tutorial Brad! It was fun

  • @enuske
    @enuske 6 лет назад

    53:46 "..Ok, its going through some crap..." I loled. Great tutorial!!!

  • @brett84c
    @brett84c 6 лет назад

    Great, simple to follow tutorial. Thank you!
    Btw, only thing that bugged me was that you weren't doing arrow functions but that's my coder OCD, heh

  • @ayushwebmaster
    @ayushwebmaster 4 года назад

    Wow 175 dislikes, no one should dislike this video, period!
    This is amazing, keep up the good work mate!

  • @redb100
    @redb100 7 лет назад

    Love the animated intro Brad, it looks awesome!

  • @Funfridaywork
    @Funfridaywork 4 года назад

    Thank you, finally I will able to start working on electron.

  • @BibIvanov
    @BibIvanov 6 лет назад

    one of the best tutorials i've ever seen. I'll try to modify it little bit, i mean add shortcuts for new item. I have one question - what can i use to store items after closing the app?

    • @soumitripattnaik
      @soumitripattnaik 5 лет назад

      Bib Ivanov You can use native JavaScript storage to persist the data, nedb is one example.

  • @scotdotwtf
    @scotdotwtf Год назад

    amazing tutorial, actually learned a lot from this.

  • @irinap.2276
    @irinap.2276 6 лет назад +1

    Amazing tutorial as usual. Thank you, Brad!

  • @tejassabunkar9079
    @tejassabunkar9079 5 лет назад +14

    Add nodeIntergeration : true
    mainWindow = new BrowserWindow({
    webPreferences: {
    nodeIntegration: true
    }
    });

  • @mmogib
    @mmogib 7 лет назад

    Thank you brother
    I do appreciate and respect what you do. Keep up the good work.
    You're making a difference in this wolrd.

  • @mayaahmed
    @mayaahmed 4 года назад

    Thanks for this great introduction to Electron JS.

  • @armenkesablyan1340
    @armenkesablyan1340 6 лет назад

    Well done my friend. Best ElectronJS Video on youtube.

  • @thanatosor
    @thanatosor 4 года назад

    This is really what Electron Tutorial should look like ..

  • @harshuldesai8901
    @harshuldesai8901 3 года назад +1

    If anyone gets a 'object could not be cloned error' during this part 32:57, new electron objects do not allow sending of non serializable objects. So a HTMLElement can no longer be sent. You can send the string in the input, though. So replace the line with:
    ipcRenderer.send('item:add', item.value);

  • @amiralmusawi9030
    @amiralmusawi9030 4 года назад

    You've got a great channel here. Thanks for all of the work, subscribed!

  • @bijay7
    @bijay7 4 года назад

    thanks @Brad for this awesome tutorial. Even after 2 years it is helping me :)

  • @azmanshaffie6399
    @azmanshaffie6399 7 лет назад

    super clear understanding! Thanks Mr Brad!

  • @andrewtechful
    @andrewtechful 7 лет назад

    Great video! Thanks a lot for sharing the knowledge. I am starting to love Electron, it's fairly easy to get the hang of.

  • @mkrichey1
    @mkrichey1 6 лет назад

    Fantastic tutorial, very well paced, many thanks!

  • @subhamshaw1726
    @subhamshaw1726 2 года назад

    Thanks for this great video. Awesome explanation and easy to read code and understand

  • @parsonsmarcus
    @parsonsmarcus 5 лет назад +4

    An invaluable set of bindings for me when using Vanilla JS is to bind "querySelector" and "querySelectorAll" to let's say a single underscore for querySelector and a double underscore for querySelectorAll:
    let _ = document.querySelector.bind(document);
    let __ = document.querySelectorAll.bind(document);
    And then this:
    document.querySelector('#item')...
    Becomes:
    _('#item')...

  • @clearbryan
    @clearbryan 6 лет назад

    Awesome video Brad. Can you please do a video on how to run an Express App in Electron