You should invoke js callback in the cocos2d thread.
This is the most simple way to do things.
But actually you may let js support multi-thread by creating more than one JSContext.
If you really want to do this, better check SpiderMonkey Docs in MDN.
You should invoke js callback in the cocos2d thread.
This is the most simple way to do things.
>
But actually you may let js support multi-thread by creating more than one JSContext.
If you really want to do this, better check SpiderMonkey Docs in MDN.
thanks for your reply.
it works when I tried to invoke it in the cocos2d thread.
and you said that create a new JSContext maybe a better solution, but it’s a little diffcult to me (´Д`)
i read the JS_SetContextThread/JS_ClearContextThread doc in MDN, but the both functions not included in jsapi.h
anyway i have a workaround so far, thank you