!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.호출할함수명으로 호출하면 됩니다.

 

  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기