https://github.com/racklin/xulapp-starterkit-addon-nodejs
NodeJS Runtime For for XULApp StarterKit. Now you can running NodeJS Tools in XULApp StarterKit.
https://github.com/racklin/xulapp-starterkit-addon-nodejs
Last synced: 10 months ago
JSON representation
NodeJS Runtime For for XULApp StarterKit. Now you can running NodeJS Tools in XULApp StarterKit.
- Host: GitHub
- URL: https://github.com/racklin/xulapp-starterkit-addon-nodejs
- Owner: racklin
- Created: 2013-01-11T03:45:35.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-03-11T02:21:35.000Z (over 11 years ago)
- Last Synced: 2024-04-09T15:28:36.526Z (about 2 years ago)
- Language: Shell
- Size: 19.2 MB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NodeJS Runtime For XULApp StarterKit
-----------------------------
NodeJS Runtime For for XULApp StarterKit. Now you can running NodeJS Tools in XULApp StarterKit.
This Add-on Contains NodeJS v0.8.17 MacOSX(32bit/64bit) and Linux(32bit/64bit) and Windows(32bit) runtime.
Download pre-build XPI
-----------------------------
Download pre-build XPI in [Download XPI](https://github.com/racklin/xulapp-starterkit-addon-nodejs/releases)
Get started
-----------------------------
Using XULApp.NodeJS.createProcess() to create a nsIProcess and initialized with node execute file.
Then you can using 'run' for running node process in foreground , using 'runAsync' running node process in background.
XULApp.NodeJS.createProcess() auto add a default observer handler, It will kill all running node process when XULApp quit.
More detail, please see [nsIProcess](https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIProcess).
Example
-----------------------------
### Running CoffeeScript compiler in block mode , wait until finish.
```
var process = XULApp.NodeJS.createProcess();
// Run the coffeescript compiler
var args = ["COFFEESCRIPT_ADDON_PATH", "-c", "/tmp/test.coffee", "-o", "test.js"];
process.run(true, args, args.length);
```
### Running express web application from XULApp (Crazy idea)
```
var process = XULApp.NodeJS.createProcess();
var args = ["YOUR EXPRESS APP"];
process.runAsync(args, args.length);
```
#### express web application demo addon
Running express web application from XULApp demo addon is here:
[expressjs-demo](https://github.com/racklin/xulapp-starterkit-addon-expressjs-demo)
License
-----------------------------
NodeJS Runtime For XULApp StarterKit are licensed under the [MPL License].
See LICENSE for more details.