Binding interface for callbacks


Please forgive me if this has been asked or demonstrated elsewhere, but how does one create a JSB binding that allows a callback function to be specified in Javascript? How does one call the callback function from C++?

I’ve had a look at the way Cocos2d-x does it for scheduled functions and the like, but I can’t seem to wrap my head around the code.