New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quitting app from node-main context #423
Comments
Hi, @ubaltaci requiring the package.json {
"name": "nw-test",
"main": "index.html",
"node-main": "foo.js"
} index.html <html>
<head>
<script >
process.mainModule.exports.gui = require('nw.gui');
process.mainModule.exports.test();
</script>
</head>
<body>
</body>
</html> foo.js exports.test = function () {
console.log(exports.gui);
} Now you can use it in the foo.js... Just a little trick, hope this will help. Anything wrong, please let me know. |
thanks @zhchbin , I understand now and works like a charm. Thanks again. |
I'd like to reference issue #299 in here, as this is one of the reasons I've proposed it. I just really don't like having |
I'm not an experienced javascript user ( or node.js ) but I have strong oop background especially in case of native mobile applications. In my app; there are multiple windows and each one handles some data which initialized and processed in node-main file. Therefore; if |
Hi;
I looked https://groups.google.com/forum/?fromgroups=#!topic/node-webkit/R8d4cpCC-6o then when I try to quit app from node context; it throws reference error. Am I missed something ?
index.js:
var gui = window.require('nw.gui');
^
ReferenceError: window is not defined
OS: OS X 10.8
NW version: 4.1
package-json: "node-main":"js/index",
The text was updated successfully, but these errors were encountered: