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 bindCallback = function(widget, json){
var callBackType = json["CallBackType"]; var callBackType = json["CallBackType"];
var callBackName = json["CallBackName"]; var callBackName = json["CallBackName"];
var callBack = function(e){
if(typeof widget[callBackName] === "function")
widget[callBackName](e);
};
if(callBackType === "Click"){ if(callBackType === "Click"){
widget.addClickEventListener(function(){ widget.addClickEventListener(callBack);
if(widget.onLocateClickCallback)
widget.onLocateClickCallback(callBackName);
});
}else if(callBackType === "Touch"){ }else if(callBackType === "Touch"){
widget.addTouchEventListener(function(){ widget.addTouchEventListener(callBack);
if(widget.onLocateTouchCallback)
widget.onLocateTouchCallback(callBackName);
});
}else if(callBackType === "Event"){ }else if(callBackType === "Event"){
widget.addCCSEventListener(function(){ widget.addCCSEventListener(callBack);
if(widget.onLocateEventCallback)
widget.onLocateEventCallback(callBackName);
});
} }
}; };