- Cross-platform Desktop Application Development:Electron,Node,NW.js,and React
- Dmitry Sheiko
- 219字
- 2021-07-15 17:36:23
Setting up an NW.js project
NW.js is an open source framework for building HTML, CSS, and JavaScript applications. You can also see it as a headless browser (based on Chromium https://www.chromium.org/) that includes Node.js runtime and provides desktop environment integration API. Actually, the framework is very easy to start with. What we need is just a start page HTML file and project manifest file (package.json).

To see it in action, we will create a project folder named file-explorer at an arbitrary location. The choice of the folder location is up to you, but I personally prefer to keep web projects in /<username>/Sites on Linux/macOS and %USERPROFILE%Sites on Windows.
As we enter the directory, we create placeholder folders for JavaScript and CSS sources (js and assets/css):

We also place a start page HTML (index.html) that consists of just a few lines:
./index.html
<!DOCTYPE html>
<html>
<body>
<h1>File Explorer</h1>
</body>
</html>
As you can guess, we shall see just this text--File Explorer-- when feeding this file to a browser.
Now, we need the Node.js manifest file (package.json). Node.js, embedded in the framework, will use it to resolve dependency package names when called with a require function or from an npm script. In addition, NW.js takes from it the project configuration data.
Why not create the manifest file and populate it with dependencies using the npm tool?
- Learn ECMAScript(Second Edition)
- Qt 5 and OpenCV 4 Computer Vision Projects
- Java EE 6 企業級應用開發教程
- PhpStorm Cookbook
- Ext JS 4 Web Application Development Cookbook
- Learning OpenStack Networking(Neutron)
- Python機器學習算法: 原理、實現與案例
- 21天學通C++(第5版)
- Hands-On Nuxt.js Web Development
- 寫給程序員的Python教程
- Beginning C++ Game Programming
- SQL Server 2008 R2數據庫技術及應用(第3版)
- Kotlin進階實戰
- 計算語言學導論
- Java語言程序設計實用教程(第2版)