with LiveScript, when you write some code in a file, the default compiler wraps the compiled code in an anonymous function :
Compiling this:
add10 = -> it + 10
gives that:
(function(){
var add10;
add10 = function(it){
return it + 10;
};
}).call(this);
And that is ok ! but i want to export some API functions for my module, so what i do now is this :
add10 = -> it + 10
this.add10 = add10
giving that :
(function(){
var add10;
add10 = function(it){
return it + 10;
};
this.add10 = add10;
}).call(this);
I work in a browser context, and i wonder if there were no better solution. It actually works but i would rahter something like this:
(function(w){
var add10;
add10 = function(it){
return it + 10;
};
w.add10 = add10;
}(this));
It's less code (no big difference in such a small example).
I'd say, use :
export add10 = (+ 10)
:).