運行CoffeeScript的類我有上的document.ready
class Main
test:->
alert "yay!"
在CoffeeScript中
,我想運行我的index.html
<script>
$(function(){
//and obv Main.test(); doesn't work
});
</script>
裏面有一個值得注意的這個網站上它說它不起作用。但我找不到如何使其工作。有任何想法嗎?我需要找出coffeescript封閉包裝是什麼。
或者coffeescript在document.ready之後執行?
thx!
答案在這裏介紹用咖啡腳本全局範圍非常好:HTTP ://stackoverflow.com/questions/4214731/coffeescript-global-variables – Marc 2012-09-12 08:08:02