The Complete Guide to Building Classic JavaScript Applications

Until recently, the development of classic applications was considered a difficult task - for this you had to learn a special programming language, such as Java or C ++. Fortunately, web developers can now create great desktop applications by converting JavaScript code into complete programs. Let's figure out what is needed for this.






, . , .





.





  1. .





  2. .





  3. Medium.





  4. .





!





1.

-, , . JavaScript , .





Electron

 β€” . , Slack, Atom, Discord, Intuit .





GitHub . , .





Chrome, , .





-, , JavaScript, HTML CSS.





NW.JS

, , . Node.js. node-webkit, , Chrome Safari.





Proton Native

Proton Native , React React Native. React, , React.js.





, Electron, , .





, React, .





, -. Electron β€” , .





2. Electron.js

: , Windows, Mac Linux.





Node.js β€” JavaScript . : https://nodejs.org/en/





node -v  npm -v .





, , Node. blog-reader-electron . npm init -y. package.json.





. Atom.io. scripts , . .





. , scripts. . package.json.





 





package.json
package.json

electron



 β€” , dev-.





 





index.js



. . index.js



, .





 





index.js
index.js

, app



  BrowserWindow



electron



.





App , , BrowserWindow



 β€” .





index.html



( ):





index.html
index.html

HTML5, , , . title



  body



 β€” .  β€” My Electron App, body .





! . . npm start



. .





title,  β€” .





.





3. Medium

, Medium , .





, .  β€” .





:





? !





. .





  1. HTML, -.





  2. Medium RSS- .





  3. .





. , , , . iframe



.





1. HTML, -

style.css



. CSS-. , , -.





index.html



:





 





HTML- body



:





index.html
index.html

, . div



id root



, .





, - inside.js



, , .





 β€” index.js



 β€” , inside.js



.





2. Medium RSS-

HTML- , Medium . RSS- β€” , JSON XML, , .





getMediumArticles



inside.js



:





inside.js
inside.js

, , fetch



, .





GET- rss2json.com



, https://forge.medium.com/feed



JSON. .





HTML :





inside.js
inside.js

, .  β€” , . html



, HTML-.





, response.feed.description



. .





, , iframe



. :





iframe



, , «», .





, iframe



 β€” .





div



, item-container



 β€” . for



:





 





div



.  β€” .





items[i].description



, , Medium HTML-.





div



html



:





 





HTML- :





 





. : , , . src  iframe



, .





:





findElement



, iframe



.





, , iframe



.





, :





: Β«, (main-title), , Β». , .





else



click



, . iframe



src



.





:





 





, , , . href



, iframe



.





findElement



  getMediumArticles



, . inside.js



:





The final inside.js script
inside.js

, getMediumArticles()



findElement()



close



. , .





3.

, . - style.css



:





 





yarn start



  npm start



. !





4.

, , Windows Mac .





:





electron-packager .





:





 





electron-packager . medium-reader



, ( ), medium-reader. .





. Mac, medium-reader-darwin-x64



:





- LICENSE- LICENSES.chromium.html- medium-reader.app- version







 β€” medium-reader.app



. , . Mac , Applications/



.





Windows, .exe



, .





! , - Electron



. , , , -: https://merunas.io/desktop-app-mastery.html





, .






"JavaScript Developer. Basic".



Β« , Β». . , HTML , CSS, JavaScript.





β€’








All Articles