JS Studio parser (Modify callback method)

This commit is contained in:
VisualSj 2015-07-22 17:56:35 +08:00
parent b282d75346
commit d4900493e2
1 changed files with 7 additions and 12 deletions

View File

@ -364,21 +364,16 @@
var bindCallback = function(widget, json){
var callBackType = json["CallBackType"];
var callBackName = json["CallBackName"];
var callBack = function(e){
if(typeof widget[callBackName] === "function")
widget[callBackName](e);
};
if(callBackType === "Click"){
widget.addClickEventListener(function(){
if(widget.onLocateClickCallback)
widget.onLocateClickCallback(callBackName);
});
widget.addClickEventListener(callBack);
}else if(callBackType === "Touch"){
widget.addTouchEventListener(function(){
if(widget.onLocateTouchCallback)
widget.onLocateTouchCallback(callBackName);
});
widget.addTouchEventListener(callBack);
}else if(callBackType === "Event"){
widget.addCCSEventListener(function(){
if(widget.onLocateEventCallback)
widget.onLocateEventCallback(callBackName);
});
widget.addCCSEventListener(callBack);
}
};