How does JSB actually work?

How to call a js function in native environment(ios, android)?
How to call a native function with js ?

I have read the documentation at The Tutorial for JSB 2.0 · Cocos Creator

But I really don’t get it, it refers to many terms that I have never worked with.

Can someone give me the most basic example code on how it works?

Thanks a lot !

cocos embeds core javascript to native (eg: v8 core, spider monkey core, charkra core, …), and communicates between cocos2d-x and javascript via c++

1 Like