An open API service indexing awesome lists of open source software.

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.

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.