Test Case Boilerplate

Fork this way...

JavaScript

sClassName = function(par1, par2) {
    this.init(par1, par2);
}
$.extend(sClassName.prototype, {
    init: function(par1, par2){
        this.addEvent();
    },
    theFunction: function(){
        alert("the function");
    },
    addEvent: function(){
        $('somedomelement').click('click', function(){
        this.theFunction();
    }.bind(this)); //<- binding the scope

}
    });