nw.js入门

来源:互联网 发布:中国利用外资数据 编辑:程序博客网 时间:2024/06/06 02:16

nw.js即原来的node-webkit, 允许你从DOM直接调用node.js中的模块。它可以让你使用任务web技术来开发本地应用。

官网:http://nwjs.io/

github: https://github.com/nwjs/nw.js

到官网上下载ZIP包,解压。

在解压后的包中创建index.html,写入如下内容:
<!DOCTYPE html><html>  <head>    <title>Hello World!</title>  </head>  <body>    <h1>Hello World!</h1>    We are using node.js <script>document.write(process.version)</script>.  </body></html>
然后创建package.json,写入如下内容:
{  "name": "nw-demo",  "version": "0.0.1",  "main": "index.html"}
注意:package.json和index.html和nw.exe(我的环境为windows下)在同一目录下。
然后运行nw.exe。一个helloworld程序就写好了。
阿里的钉钉就是使用nwjs开发的,其好处当然是很多。会web开发就能开发本地应用,可以发布到window,linux,mac等不同平台。



0 0
原创粉丝点击