Created
June 22, 2012 05:51
-
-
Save vvakame/2970602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global) { | |
var Hoge, Fuga, SampleView; | |
Hoge = (function() { | |
function Hoge() { | |
} | |
Hoge.prototype.init = function(str) { | |
str = str || "hoge"; | |
alert(str); | |
} | |
return Hoge; | |
})(); | |
Fuga = (function() { | |
var msg = "fuga"; | |
function Fuga() { | |
this.msg = "Fuga"; | |
} | |
Fuga.msg = "FUGA"; | |
Fuga.prototype.message = function() { | |
return msg + this.msg + Fuga.msg; | |
}; | |
return Fuga; | |
})(); | |
SampleView = (function() { | |
var $el; | |
function SampleView(attr) { | |
attr = attr || {}; | |
$el = attr.$el; | |
$el.html(attr.model.message()); | |
} | |
return SampleView; | |
})(); | |
global.Hoge = Hoge; | |
global.Fuga = Fuga; | |
global.SampleView = SampleView; | |
}(window)); | |
$(function() { | |
// new Hoge().init("test"); | |
// new Hoge().init(); | |
// console.log(Hoge); | |
// console.log(Fuga); | |
new SampleView({ | |
$el: $("#sample"), | |
model: new Fuga() | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment