2014-11-05 7 views
0

첫 번째 클릭 후 .on() 메서드를 변경하고 싶습니다.Famo.us의 .on() 메서드를 덮어 쓰려면 어떻게합니까?

mySurface.on("touchstart",function(){ 
     doSomethingDifferent();  
}) 

가 어떻게 내 CSTE 연구진 방법을 덮어 쓸 수 있습니다 :

mySurface.on("touchstart",function(){ 
     doSomething();  
}) 

첫 번째 후

난에, 예를 들어를 변경하려면 클릭?

답변

0

.on() 메서드를 덮어 쓰는 것은 여기에 귀하의 경우 실제로 필요하지 않습니다.

다음은 사용 사례를 처리하는 한 가지 방법입니다.

var doSomethingElse = function(event) { 
    console.log('doSomethingElse', event); 
    console.log('mySurface', this); 
    }; 

    var doSomething = function(event) { 
    console.log('doSomething', event); 
    console.log('mySurface', this); 
    func = doSomethingElse; 
    }; 

    var func = doSomething; 

    mySurface.on("touchstart",function(event){ 
    func.call(this, event);  
    });