!function($) {
/*------------------------------------------------------------------
CounSel Module
-------------------------------------------------------------------*/
var CounSel = function() {
var _this = this;
}
CounSel.prototype.add = function(_this) {
_this.sendidx();
}
CounSel.prototype.sendidx = function(_this) {
}
/*------------------------------------------------------------------
Init CounSel
-------------------------------------------------------------------*/
CounSel.prototype.init = function () {
_this = this;
var submitAction = function(e){
e.preventDefault();
e.stopPropagation();
};
$('form').bind('submit', submitAction);
_this.add(_this);
}
window.counsel = new CounSel();
$(window).on('load', function() {
counsel.init();
});
}(jQuery)
$('form').bind 밑에 _this.* 가 함수를 호출 하는 것 입니다.
위 예제를 보면
CounSel이 하나의 대분류라고 생각하고 소분류가 각 함수라고 보시면 됩니다.
또한 함수에서 함수를 호출할때는 _this.호출할함수명으로 호출하면 됩니다.
'JavaScript' 카테고리의 다른 글
[JavaScript] 템플릿 문자열 (0) | 2021.06.03 |
---|---|
[JavaScript] Javascript OOP(Object-Oriented) Prototype (0) | 2021.05.22 |
[Javascript] 객체 생성 (new Object()) (0) | 2021.05.03 |
[JavaScript] 자바스크립트 함수 호이스팅 (JavaScript function hoisting) (0) | 2021.04.06 |
[jQuery] jQuery 구조화된 기본 코드 (0) | 2021.01.04 |
최근댓글