Skip to content

Instantly share code, notes, and snippets.

@vvakame
Created June 22, 2012 05:51
Show Gist options
  • Save vvakame/2970602 to your computer and use it in GitHub Desktop.
Save vvakame/2970602 to your computer and use it in GitHub Desktop.
(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