I am quite new to coffeescript, although I want to learn in order to optimize my workflow in the future.
The problem is that I am missing out some concepts, for example
var foo = {
init: function() {
this.ui.build();
this.bindEvents();
},
bindEvents: function() {}
...
}
$('document').ready(function(){
foo.init();
})
translated like this in coffeescript
foo =
init: ->
@.ui.build();
@.bindEvents();
bindEvents: ->
...
...
$('document').ready(->
foo.init();
)
What did I do wrong? What are your suggestions in my way of creating objects?
foo = ...and$(document).ready(...)in different files?