Fixup some Browserify errors, indicate support in README

This commit is contained in:
Andrew Stewart 2014-10-21 11:31:22 -07:00
parent bd95f9eb3c
commit 3f9a7cf148
2 changed files with 35 additions and 0 deletions

View File

@ -159,6 +159,34 @@ cylon.robot({
.start();
```
## Browser Support
As of 0.20.0, Cylon can be run directly in-browser, using the `browserify` NPM module.
With the `browserify` tool installed, you can compile examples like this for the
browser easily:
```javascript
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'leapmotion', adaptor: 'leapmotion', port: '127.0.0.1:6437' },
device: { name: 'leapmotion', driver: 'leapmotion' },
work: function(my) {
my.leapmotion.on('hand', function(hand) {
console.log(hand.palmPosition.join(','));
});
}
}).start();
```
To compile it, use the `browserify` tool as so:
$ browserify script.js -r cylon-leapmotion > browser_script.js
For more info on browser support, and for help with different configurations, you can find more info [on our website](http://cylonjs.com/documentation/browser-support).
## Hardware Support
Cylon.js has an extensible syntax for connecting to multiple, different hardware

View File

@ -17,6 +17,13 @@ var Connection = require("./connection"),
var Async = require("async"),
EventEmitter = require('events').EventEmitter;
// Require these modules here, so Browserify can grab them later if necessary.
require('./test/loopback');
require('./test/test-adaptor');
require('./test/test-driver');
require('./test/ping');
var missingModuleError = function(module) {
var string = "Cannot find the '" + module + "' module. ";
string += "Please install it with 'npm install " + module + "' and try again.";