There is a new tool 'nwsnapshot' in the zip file. It's for the new feature of protecting JS source code. You can just remove it if you don't need this feature.
New features ========== * Strong JS source code protection (experimental): The JavaScript source code of your application can be protected by
compiling to native code. Only the native code is distributed with the
application and is loaded when the application starts.
This feature is still experimental -- API & tool usage are subject to change in future versions. See the document for usage, limitations and sample: https://github.com/rogerwang/node-webkit/wiki/Protect-JavaScript-source-code-with-v8-snapshot
And exec "nwsnapshot --extra_code foo.js foo.bin".
But it said "Uncaught ReferenceError: require is not defined at ...
Does nwsnapshot not know node functions?
Regards,
abeq
Roger WANG
unread,
Feb 20, 2013, 11:22:46 PM2/20/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to abeq, node-...@googlegroups.com
It doesn't know Node nor DOM. You should remove the last line, just keep
the function definition there and call it from other places of your app.
--
Roger WANG Intel Open Source Technology Center
Roger WANG
unread,
Feb 20, 2013, 11:23:56 PM2/20/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to abeq, node-...@googlegroups.com
"And the scripts runs/loads loads very early (you can assume it's
earlier than context creation) so DOM objects such as window is not
defined. So you may want to defined functions and pass window as
argument."
> I've found the cause. "showDevTools" function somehow influences ist.
>
> var gui = require('nw.gui');
>
> gui.Window.get().showDevTools();
>
> var wnd = gui.Window.open("http://www.google.de")
> wnd.on("loaded",function(){
> alert("Loaded");
> });
>
> If you run the app with this code sometimes no alert is shown. You can put
> the window openning code into a function
> and launch on a button click it has the same result.