BAM Weblog

Roy - Browser Modules

Brian McKenna — 2012-01-29

This week I started work on Roy browser modules. The code is the same as node.js modules. So this:

let obj = {x: 1, y: 2, t: "test"}
export obj

Will compile into this (in browser mode):

var _obj;
(function() {
var obj = {
"x": 1,
"y": 2,
"t": "test"
};
_obj = obj;
})();

It currently prefixes the global variables with an underscore. This was just for the initial version and I hope to get rid of it soon.

Please enable JavaScript to view the comments powered by Disqus.