What does node-webkit mean?

WBOY
Release: 2022-02-28 16:33:16
Original
2882 people have browsed it

"node-webkit" is an application running environment based on "node.js" and chromium; this environment can package web applications built on the browser and "node.js" into desktop applications. That is to use HTML, css and JavaScript to write PC desktop applications.

What does node-webkit mean?

The operating environment of this article: Windows 10 system, nodejs version 12.19.0, Dell G3 computer.

What does node-webkit mean

node-webkit is an application running environment based on node.js and chromium, through which we can build on the chrome browser and node.js The web application is packaged into a desktop application, and it can also be cross-platform. Obviously, compared to traditional desktop applications, web applications developed with html5 css3 js in certain specific areas are simpler and more efficient, and can also use the functions of node.js, so node-webkit is still very useful. It enables programmers who only know JavaScript and HTML to develop desktop applications, and it is open source.

That is to say, we can implement a localized application through HTML, CSS, and JavaScript. The most creative part of the entire project is the integration of node.js, which allows application developers to use the node.js module directly in the DOM, greatly enhancing the capabilities of web-side JavaScript. The project is developed and maintained by the Intel Open Source Project Center.

In fact, it can be understood as writing a web app. But you can use the node.js API, and finally package the entire application with the browser and publish it. Therefore, it is not restricted by the platform (except for using node.js to call the operating system API). Just package a code and publish it on the corresponding platform. If you have knowledge of phonegap/cordova. This node-webkit is very similar to them. It’s just the addition of node.js.

Here is an introduction to the operation process of developing a project using node-webkit.

Download node-webkit

Download the file corresponding to the operating system at https://github.com/rogerwang/node-webkit. Just unzip it. It is recommended to add it to the environment variables.

New project

Create a new project folder. C:/Users/keith/node/webkitdemo

New package.json

 <!DOCTYPE html>
 <html>
   <head>
     <title>Hello World!</title>
   </head>
   <body>
     <h1>Hello Node-webkit</h1>
         Node.js version: <script>document.write(process.version)</script>.
   </body>
 </html>
Copy after login

Run

In the command line:

 npm install node-webkit-builder -g
 cd C:/Users/keith/node/
 nwbuild -p win C:/Users/keith/node/webkitdemo/
 cd build/demo/win/
 ./demo.exe  //运行程序
Copy after login

At this time, you can choose to directly compress the compiled folder and publish it, or you can choose to package the compiled folder into an exe file and publish it directly. exe file, if you want to do this, you need a tool Enigma Virtual Box. After installation, run Enigma virtual box

In Enter Input File Name, select C:/Users/keith/node/build/win/demo.exe file, then click the add button below to add all dll files and nw.pak in the C:/Users/keith/node/build/demo/win directory, then click Files Options, check the compress compressed file, and finally click Process to complete. .

Summary

You can easily develop some pc desktop applications through node-webkit, and combined with node.js, you can develop many interesting things, such as combining node .js creates a local server, operates local files, etc. Cross-platform applications can be developed quickly. The disadvantage is that the packaged application is large, even after compression, it is 3.40M.

Recommended learning: "nodejs video tutorial"

The above is the detailed content of What does node-webkit mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!