node.js - nwjs中参数node-remote能被动态的设置吗?
PHP中文网
PHP中文网 2017-04-17 11:40:48
0
1
321

看使用说明,没提及到可以动态的在运行时设置这个参数的方法。
只能是应用启动时配置一个或多个url。

https://github.com/nwjs/nw.js/wiki/Manifest-format#user-content-node-r...

PHP中文网
PHP中文网

认证高级PHP讲师

全部回覆 (1)
左手右手慢动作

可以变通一下,获取到新的地址之后写入package.json然后重启

var manifest = gui.App.manifest; manifest['node-remote'] = 'xxxxx.com'; fs.writeFileSync('package.json',JSON.stringify(manifest));

然后下一次启动的时候就使用新的值了,如果不想下一次使用就手动重启,重启代码

var child, child_process, executable = process.execPath; child_process = require("child_process"); child = child_process.spawn(executable, ['--restart'], { detached: true, cwd : path.dirname(executable) }); child.unref();
    最新下載
    更多>
    網站特效
    網站源碼
    網站素材
    前端模板
    關於我們 免責聲明 Sitemap
    PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!