JS binding completeness

JS binding completeness
0.0 0


Please correct me if I’m mistaken, but it looks like a fair amount of the API available via C++ doesn’t have Javascript bindings yet. As an example, it looks like there’s no direct access to CCUserDefault, or to CCLabelTTF.

  1. Is this correct? Or, am I simply looking in the wrong place?
  2. Is the intent to make the entirety of the API available?
  3. I can write my own bindings, but at that point I may as well contribute them back upstream. Is there a documented way on how to contribute JS bindings?

Thanks for any help!


You can check out the API for the auto-generated bindings here: https://github.com/folecr/cocos2dx-autogen-bindings/blob/master/jsb_cocos2dx_auto_api.js CCLabelTTF is bound (as cc.LabelTTF)
There are also things that are manually bound, you’ll have to check these files separately: https://github.com/cocos2d/cocos2d-x/tree/master/scripting/javascript/bindings/js


Looks like I was indeed looking at the wrong place :slight_smile:

It looks like some classes I’m interested in using aren’t in either of those locations, though. For example, I don’t see any bindings for CCTextFieldTTF. I’d like to use this class, and I’m open to contributing the work I do back upstream. It looks like I’d need to modify tools/tojs to get the bindings generated. Is this the correct approach?


JSB use sys.LocalStorage to save game data.
You could use cc.EditBox instead of CCTextFieldTTF.


sys.LocalStorage is what I ended up using, likewise with cc.EditBox (after wrestling for some time with CCTextFieldTTF). I saw in another thread somewhere that CCTextFieldTTF was deprecated; some sort of notice on the documentation to this effect would be great :slight_smile: