メモ
class Foo @hoge: "this is property hoge" @fuga: (p) -> alert "ふがふが #{p}" piyo: (p) -> alert "ぴよぴよ #{p}" foo = new Foo(); console.log foo.hoge Foo.fuga "うんこ" foo.piyo "うんこ"
var Foo, foo; Foo = (function() { function Foo() {} Foo.hoge = "this is property hoge"; Foo.fuga = function(p) { return alert("ふがふが " + p); }; Foo.prototype.piyo = function(p) { return alert("ぴよぴよ " + p); }; return Foo; })(); foo = new Foo(); // これundefined console.log(foo.hoge); Foo.fuga("うんこ"); foo.piyo("うんこ");
結論
- アットマークはstatic