Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
CommonJS
          JavaScript Everywhere




Kevin Dangoor, Kris Kowal, Tom Robinson
        jsconf.eu — 2009-11-07
Kevin Dangoor
 Mozilla Labs
Kris Kowal
FastSoft, Inc.
problem + CommonJS = solution
There are many ways
 to do these things
   in JavaScript.




There is no standard
way to do these things
    in JavaScrip...
import json
import hashlib                        var file = require("file");
import sys                            var sy...
bash-3.2$ python simple.py testdata.json
900150983cd24fb0d6963f7d28e17f72
bash-3.2$ js simple.js testdata.json
900150983cd...
CommonJS

You can make a difference!
   http://commonjs.org/
Q&A

http://commonjs.org/
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
CommonJS: JavaScript Everywhere
Upcoming SlideShare
Loading in …5
×

CommonJS: JavaScript Everywhere

7,005 views

Published on

JavaScript is an enormously popular programming language, because of its unique place as the programming language of the web. Outside of that domain, JS is barely a blip compared to other dynamic languages like Python and Ruby. Outside of the browser, JavaScript is lacking something critical: a significant standard library. Thanks to a powerful standard library and a common module system, sophisticated applications can be written in Python and run unchanged on Windows, Mac and Linux and even across different interpreters including Jython and IronPython. The CommonJS project (formerly ServerJS) is building up a standard library API to give privileged JavaScript applications this same kind of interop. Imagine a server-side webapp that runs equally well in Rhino, SpiderMonkey and v8. We're getting there. Even better, those apps can easily share modules between the browser and the server, which is something you don't get in other languages. In this talk, I'll provide quick background on the project and demos of several implementations of the emerging standard, including how CommonJS impacts Mozilla's Jetpack and Bespin projects.

  • Be the first to comment

CommonJS: JavaScript Everywhere

  1. 1. CommonJS JavaScript Everywhere Kevin Dangoor, Kris Kowal, Tom Robinson jsconf.eu — 2009-11-07
  2. 2. Kevin Dangoor Mozilla Labs
  3. 3. Kris Kowal FastSoft, Inc.
  4. 4. problem + CommonJS = solution
  5. 5. There are many ways to do these things in JavaScript. There is no standard way to do these things in JavaScript.
  6. 6. import json import hashlib var file = require("file"); import sys var system = require("system"); var md5 = require("md5"); def main(args): raw_data = open(args[1]).read() exports.main = function(args) { strings = json.loads(raw_data) var rawData = file.read(args[1]); h = hashlib.md5() var strings = JSON.parse(rawData); var hashed = md5.hash(strings.join("")); for s in strings: print(hashed.toString(16)); h.update(s) }; print h.hexdigest() if (module.id == require.main) { exports.main(system.args); if __name__ == "__main__": } main(sys.argv)
  7. 7. bash-3.2$ python simple.py testdata.json 900150983cd24fb0d6963f7d28e17f72 bash-3.2$ js simple.js testdata.json 900150983cd24fb0d6963f7d28e17f72 http://www.codinghorror.com/blog/archives/000818.html
  8. 8. CommonJS You can make a difference! http://commonjs.org/
  9. 9. Q&A http://commonjs.org/

×