It’s defined here
var CMenu = cc.Sprite.extend({
onClickCallback: null,
onClick: function (callback) {
this.onClickCallback = callback;
},
handleTouches: function (touch, evt) {
(this.hovered && this.onClickCallback) && this.onClickCallback();});
It’s being called here
backMenu.onClick(function () {
window.location.href = "http://www.test.com";
});
is this.onClickCallback = this.onClickCallback()?
this.onClickCallbacksimply refers to the propertyonClickCallbackof thethisobject. This will give you the function itself. On the other handthis.onClickCallback()executes that property considering it as a function and will return its result.So
this.onClickCallbackis not the same asthis.onClickCallback()