nw.jsが12.0 rc1になっていた。nwjcが目を引く今回のアップデート。

公開:2015-03-03 05:14
更新:2020-02-15 04:37
カテゴリ:nw.js,javascript,nw.jsでデスクトップアプリを作る

nw.jsが12.0 rc1になっていた。

http://nwjs.io/

リリース・ノートで目を引くのは以下のところ。

* Usage of the new 'nwjc' tool, which replaces 'nwsnaphsot' to remove the size limitation and support closure:
- compile your JS file with nwjc:
nwjc <jsfile> <bin output filename>

then in your app:
require('nw.gui').Window.get().evalNWBin(null, 'your.bin');

The arguments of the evalNWBin() method are similar with the Window.eval() method, where the first parameter is the target iframe ('null' for main frame), and the 2nd parameter is the binary code file.

 nwjcというネイティブコードに変換するコンパイラがついてきて、サイズ制限が排除され、クロージャのサポートがなされたとのこと。なかなか面白そうである。jitでコンパイルした結果を静的にキャッシュするようなイメージなのかな。本件については以下のページが詳しそうだ。

Protect JavaScript source code with v8 snapshot · nwjs/nw.js Wiki · GitHub

ネイティブコードへ変換するのだがパフォーマンスは通常のJSより3割ほど落ちるらしい。ちょっと残念な感じだ。JSコードの難読化に多少役にたつ程度か。