What is the use of jQuery Connect?

 Posted by Niladri.Biswas on 7/19/2012 | Category: jQuery Interview questions | Views: 1670 | Points: 40
Answer:

It is used to connect or bind a function to another function.It is use to execute a function whenever
a function from another object is executed.

e.g.

function FirstFunction(){ 

this.Func1 = function(){
execute1 = 'A class';
}
}
var firstFunc = new FirstFunction();

function SecondFunction(){
this.Func2 = function(){
execute2 = 'Another Class';
}
}
var secondFunc = new SecondFunction();
$.connect(firstFunc,'Func1',secondFunc,Func2);


In this case whevever we invoke secondFunc.Func2,firstFunc.Func1 will also gets executed indicating that
Func2 of object secondFunc has been associated/ connected to Func1 of object firstFunc


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response