hybridgroup / cylon

JavaScript framework for robotics, drones, and the Internet of Things (IoT)
https://cylonjs.com
Other
4.2k stars 360 forks source link

Cylon chrome example - how is browser.js generated? #350

Open vivek1729 opened 8 years ago

vivek1729 commented 8 years ago

Absolutely love the work you guys are doing and I firmly believe that javascript is the way to go with everything. I want to make a Chrome App using cylon.js and therefore stumbled upon this repo from this blog post. Looking through the README, it's documented that we have to write our code in the script.js file for instance and bundle it using Browserify like so:

 ./node_modules/.bin/browserify -r cylon-gpio -r cylon-i2c -r cylon-firmata script.js > ./js/robot.js

While this makes sense to me, after going through browser.js file which is inculded by default in index.html, I notice that there are chrome specific serial API's used there supporting the chrome runtime. Does, Browserify accomplish it by default? I doubt.

So, if I want to modify script.js to support different device having different code, how do I bundle it successfully utilizing the Chrome API's or how do I use browser.js to build the bundled js file otherwise?

Referencing issue - https://github.com/hybridgroup/cylon-example-chrome/issues/1