Classes | |
class | ScriptingCore |
ScriptingCore is the main class which manages interaction with JavaScript environment. More... | |
Functions | |
static ScriptingCore * | getInstance () |
ScriptingCore is a singleton class, you can retrieve its instance with this function. More... | |
virtual cocos2d::ccScriptType | getScriptType () override |
Gets the script type, for ScriptingCore, it will return cocos2d::kScriptTypeJavascript More... | |
local | getScriptType () |
Gets the script type, for ScriptingCore, it will return cocos2d::kScriptTypeJavascript More... | |
virtual void | retainScriptObject (cocos2d::Ref *owner, cocos2d::Ref *target) override |
Reflect the retain relationship to script scope. | |
var | retainScriptObject ( var owner, var target) |
Reflect the retain relationship to script scope. | |
local | retainScriptObject ( local owner, local target) |
Reflect the retain relationship to script scope. | |
virtual void | rootScriptObject (cocos2d::Ref *target) override |
Add the script object to root object. | |
virtual void | releaseScriptObject (cocos2d::Ref *owner, cocos2d::Ref *target) override |
Reflect the release relationship to script scope. | |
var | releaseScriptObject ( var owner, var target) |
Reflect the release relationship to script scope. | |
local | releaseScriptObject ( local owner, local target) |
Reflect the release relationship to script scope. | |
virtual void | unrootScriptObject (cocos2d::Ref *target) override |
Remove the script object from root object. | |
virtual void | releaseAllChildrenRecursive (cocos2d::Node *node) override |
Release all children in script scope. | |
virtual void | releaseAllNativeRefs (cocos2d::Ref *owner) override |
Release all native refs for the given owner in script scope. | |
local | releaseAllNativeRefs ( local owner) |
Release all native refs for the given owner in script scope. | |
virtual void | removeScriptObjectByObject (cocos2d::Ref *obj) override |
Removes the C++ object's linked JavaScript proxy object from JavaScript context. More... | |
virtual int | executeString (const char *codes) override |
Useless in ScriptingCore, please use evalString. More... | |
void | pauseSchedulesAndActions (js_proxy_t *p) |
Pause scheduled tasks and actions for an object proxy. More... | |
void | resumeSchedulesAndActions (js_proxy_t *p) |
Resume scheduled tasks and actions for an object proxy. More... | |
void | cleanupSchedulesAndActions (js_proxy_t *p) |
Cleanup scheduled tasks and actions for an object proxy. More... | |
virtual int | executeScriptFile (const char *filename) override |
Useless in ScriptingCore, please use runScript. More... | |
virtual int | executeGlobalFunction (const char *functionName) override |
Useless in ScriptingCore, please use executeFunctionWithOwner. More... | |
virtual int | sendEvent (cocos2d::ScriptEvent *message) override |
When trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in Lua. | |
virtual bool | parseConfig (ConfigType type, const std::string &str) override |
Parse configuration file. More... | |
local | parseConfig ( local type, local str) |
Parse configuration file. More... | |
virtual bool | handleAssert (const char *msg) override |
Useless in ScriptingCore. More... | |
virtual void | setCalledFromScript (bool callFromScript) override |
Useless for Lua. | |
virtual bool | isCalledFromScript () override |
Useless for Lua. | |
bool | executeFunctionWithObjectData (void *nativeObj, const char *name, JSObject *obj) |
Execute a js function with a JavaScript object as parameter. More... | |
bool | executeFunctionWithOwner (jsval owner, const char *name, uint32_t argc, jsval *vp) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments. More... | |
var | executeFunctionWithOwner ( var owner, var name, var argc, var vp) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments. More... | |
local | executeFunctionWithOwner ( local owner, local name, local argc, local vp) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments. More... | |
bool | executeFunctionWithOwner (jsval owner, const char *name, uint32_t argc, jsval *vp, JS::MutableHandleValue retVal) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value. More... | |
var | executeFunctionWithOwner ( var owner, var name, var argc, var vp, var retVal) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value. More... | |
local | executeFunctionWithOwner ( local owner, local name, local argc, local vp, local retVal) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value. More... | |
bool | executeFunctionWithOwner (jsval owner, const char *name, const JS::HandleValueArray &args) |
Execute a js function with a JavaScript caller, function name, arguments array. More... | |
bool | executeFunctionWithOwner (jsval owner, const char *name, const JS::HandleValueArray &args, JS::MutableHandleValue retVal) |
Execute a js function with a JavaScript caller, function name, arguments array and a return value. More... | |
void | executeJSFunctionWithThisObj (JS::HandleValue thisObj, JS::HandleValue callback) |
Execute a js function with a js this object and the js function object. More... | |
void | executeJSFunctionWithThisObj (JS::HandleValue thisObj, JS::HandleValue callback, const JS::HandleValueArray &vp, JS::MutableHandleValue retVal) |
Execute a js function with a js this object, the js function object, arguments and a return value. More... | |
bool | evalString (const char *string, JS::MutableHandleValue outVal, const char *filename, JSContext *cx, JS::HandleObject global) |
Evaluate the specified js code string. More... | |
bool | evalString (const char *string, JS::MutableHandleValue outVal) |
Evaluate the specified js code string. More... | |
bool | evalString (const char *string) |
Evaluate the specified js code string. More... | |
JS::PersistentRootedScript * | getScript (const std::string &path) |
Get script object for the given path. More... | |
local | getScript ( local path) |
Get script object for the given path. More... | |
JS::PersistentRootedScript * | compileScript (const std::string &path, JS::HandleObject global, JSContext *cx=nullptr) |
Compile the specified js file. More... | |
local | compileScript ( local path, local global, local nullptr) |
Compile the specified js file. More... | |
bool | runScript (const std::string &path) |
Run the specified js file. More... | |
bool | runScript (const std::string &path, JS::HandleObject global, JSContext *cx=NULL) |
Run the specified js file. More... | |
local | runScript ( local path, local global, local NULL) |
Run the specified js file. More... | |
bool | requireScript (const char *path, JS::MutableHandleValue jsvalRet) |
Require the specified js file The difference between run and require is that require returns the export object of the script. More... | |
local | requireScript ( local path, local jsvalRet) |
Require the specified js file The difference between run and require is that require returns the export object of the script. More... | |
bool | requireScript (const char *path, JS::HandleObject global, JSContext *cx, JS::MutableHandleValue jsvalRet) |
Require the specified js file The difference between run and require is that require returns the export object of the script. More... | |
local | requireScript ( local path, local global, local cx, local jsvalRet) |
Require the specified js file The difference between run and require is that require returns the export object of the script. More... | |
void | cleanScript (const char *path) |
Clean script object for the specified js file. More... | |
std::unordered_map < std::string, JS::PersistentRootedScript * > & | getFileScript () |
Gets the cached script objects for all executed js file. More... | |
void | cleanAllScript () |
Clean all script objects. | |
std::chrono::steady_clock::time_point | getEngineStartTime () const |
Gets the time that the ScriptingCore was initalized. | |
local | getEngineStartTime () |
Gets the time that the ScriptingCore was initalized. | |
void | start () |
Initialize everything, including the js context, js global object etc. | |
void | cleanup () |
Cleanup everything, including script cache, js context, global object etc. | |
void | reset () |
Cleanup everything then initialize everything. | |
void | addRegisterCallback (sc_register_sth callback) |
Add the register_sth callback to the list of functions that need to be called after the creation of the context. More... | |
void | createGlobalContext () |
Create a new context. More... | |
static void | removeAllRoots (JSContext *cx) |
Removes all rooted object in the given js context, rooted object won't be garbage collected. More... | |
int | executeCustomTouchEvent (cocos2d::EventTouch::EventCode eventType, cocos2d::Touch *pTouch, JSObject *obj, JS::MutableHandleValue retval) |
Simulate a touch event and dispatch it to a js object. More... | |
int | executeCustomTouchEvent (cocos2d::EventTouch::EventCode eventType, cocos2d::Touch *pTouch, JSObject *obj) |
Simulate a touch event and dispatch it to a js object. More... | |
int | executeCustomTouchesEvent (cocos2d::EventTouch::EventCode eventType, const std::vector< cocos2d::Touch * > &touches, JSObject *obj) |
Simulate a multi touch event and dispatch it to a js object. More... | |
JSContext * | getGlobalContext () |
Gets the current global context. More... | |
static void | reportError (JSContext *cx, const char *message, JSErrorReport *report) |
Report an error in the js context. More... | |
var | reportError ( var cx, var message, var report) |
Report an error in the js context. More... | |
local | reportError ( local cx, local message, local report) |
Report an error in the js context. More... | |
static bool | log (JSContext *cx, uint32_t argc, jsval *vp) |
Log something to the js context using CCLog. More... | |
bool | setReservedSpot (uint32_t i, JSObject *obj, jsval value) |
Sets a js value to the targeted js object's reserved slot, which is not exposed to script environment. More... | |
static bool | executeScript (JSContext *cx, uint32_t argc, jsval *vp) |
Runs a script from script environment, it should be invoked from script environment Bound to __jsc__.executeScript and window.executeScript More... | |
local | executeScript ( local cx, local argc, local vp) |
Runs a script from script environment, it should be invoked from script environment Bound to __jsc__.executeScript and window.executeScript More... | |
static bool | forceGC (JSContext *cx, uint32_t argc, jsval *vp) |
Forces a cycle of garbage collection, it should be invoked from script environment Bound to __jsc__.garbageCollect and window.garbageCollect More... | |
local | forceGC ( local cx, local argc, local vp) |
Forces a cycle of garbage collection, it should be invoked from script environment Bound to __jsc__.garbageCollect and window.garbageCollect More... | |
static bool | dumpRoot (JSContext *cx, uint32_t argc, jsval *vp) |
Dump all named rooted objects, it should be invoked from script environment Bound to __jsc__.dumpRoot More... | |
local | dumpRoot ( local cx, local argc, local vp) |
Dump all named rooted objects, it should be invoked from script environment Bound to __jsc__.dumpRoot More... | |
static bool | isObjectValid (JSContext *cx, uint32_t argc, jsval *vp) |
Check whether a js object's C++ proxy is still valid, it should be invoked from script environment Bound to window.__isObjectValid More... | |
local | isObjectValid ( local cx, local argc, local vp) |
Check whether a js object's C++ proxy is still valid, it should be invoked from script environment Bound to window.__isObjectValid More... | |
void | debugProcessInput (const std::string &str) |
Log a string to the debug environment. More... | |
void | enableDebugger (unsigned int port=5086) |
Enable the debug environment, mozilla Firefox's remote debugger or Code IDE can connect to it. More... | |
JSObject * | getDebugGlobal () |
Gets the debug environment's global object. More... | |
JSObject * | getGlobalObject () |
Gets the global object. More... | |
bool | isFunctionOverridedInJS (JS::HandleObject obj, const std::string &name, JSNative native) |
Checks whether a C++ function is overridden in js prototype chain. More... | |
virtual void | rootObject (cocos2d::Ref *ref) override |
Roots the associated JSObj. More... | |
virtual void | unrootObject (cocos2d::Ref *ref) override |
Unroots the associated JSObj. More... | |
local | unrootObject ( local ref) |
Unroots the associated JSObj. More... | |
virtual void | removeObjectProxy (cocos2d::Ref *obj) override |
Remove proxy for a native object. | |
local | removeObjectProxy ( local obj) |
Remove proxy for a native object. | |
virtual void | garbageCollect () override |
Calls the Garbage Collector. | |
void | setFinalizing (JSObject *finalizing) |
Sets the js object that is being finalizing in the script engine, internal use only, please do not call this function. | |
JSObject * | getFinalizing () |
Gets the js object that is being finalizing in the script engine. | |
js_proxy_t * | jsb_new_proxy (void *nativeObj, JS::HandleObject jsObj) |
creates two new proxies: one associated with the nativeObj, and another one associated with the JsObj | |
js_proxy_t * | jsb_get_native_proxy (void *nativeObj) |
returns the proxy associated with the Native* | |
js_proxy_t * | jsb_get_js_proxy (JS::HandleObject jsObj) |
returns the proxy associated with the JSObject* | |
void | jsb_remove_proxy (js_proxy_t *nativeProxy, js_proxy_t *jsProxy) |
deprecated: use jsb_remove_proxy(js_proxy_t* proxy) instead | |
void | jsb_remove_proxy (js_proxy_t *proxy) |
removes both the native and js proxies | |
void | removeJSObject (JSContext *cx, cocos2d::Ref *nativeObj) |
removes the native js object proxy and unroot the js object (if necessary), it's often used when JS object is created by native object | |
void | jsb_ref_init (JSContext *cx, JS::Heap< JSObject * > *obj, cocos2d::Ref *ref, const char *debug) |
Generic initialization function for subclasses of Ref. | |
void | jsb_ref_autoreleased_init (JSContext *cx, JS::Heap< JSObject * > *obj, cocos2d::Ref *ref, const char *debug) |
Generic initialization function for subclasses of Ref. More... | |
void | jsb_ref_rebind (JSContext *cx, JS::HandleObject jsobj, js_proxy_t *js2native_proxy, cocos2d::Ref *oldRef, cocos2d::Ref *newRef, const char *debug) |
Disassociates oldRef from jsobj, and associates a new Ref. More... | |
void | jsb_non_ref_init (JSContext *cx, JS::Heap< JSObject * > *obj, void *native, const char *debug) |
Generic initialization function for non Ref classes. | |
JSObject * | jsb_ref_create_jsobject (JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char *debug) |
Creates a new JSObject of a certain type (typeClass) and creates a proxy associated with and the Ref. | |
JSObject * | jsb_ref_autoreleased_create_jsobject (JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char *debug) |
Creates a new JSObject of a certain type (typeClass) and creates a proxy associated with and the Ref Similar to jsb_ref_create_jsobject(), but call it if you know that Ref has been autoreleased This function should never be called. More... | |
JSObject * | jsb_create_weak_jsobject (JSContext *cx, void *native, js_type_class_t *typeClass, const char *debug) |
It will try to get the associated JSObjct for the native object. More... | |
JSObject * | jsb_ref_get_or_create_jsobject (JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char *debug) |
It will try to get the associated JSObjct for ref. More... | |
JSObject * | jsb_ref_autoreleased_get_or_create_jsobject (JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char *debug=nullptr) |
It will try to get the associated JSObjct for ref. More... | |
CC_JS_DLL JSObject * | jsb_get_or_create_weak_jsobject (JSContext *cx, void *native, js_type_class_t *typeClass, const char *debug=nullptr) |
It will try to get the associated JSObjct for the native object. More... | |
void | jsb_register_finalize_hook (JSObject *hook, JSObject *owner) |
Register finalize hook and its owner as an entry in _js_hook_owner_map, so that we can find the owner of a FinalizeHook in its finalize function. | |
JSObject * | jsb_get_and_remove_hook_owner (JSObject *hook) |
Remove the entry of finalize hook and its owner in _js_hook_owner_map. | |
|
static |
ScriptingCore is a singleton class, you can retrieve its instance with this function.
|
static |
ScriptingCore is a singleton class, you can retrieve its instance with this function.
|
static |
ScriptingCore is a singleton class, you can retrieve its instance with this function.
|
inlineoverridevirtual |
Gets the script type, for ScriptingCore, it will return cocos2d::kScriptTypeJavascript
cocos2d::kScriptTypeJavascript
Reimplemented from ScriptEngineProtocol.
|
inlineoverridevirtual |
Gets the script type, for ScriptingCore, it will return cocos2d::kScriptTypeJavascript
cocos2d::kScriptTypeJavascript
Reimplemented from ScriptEngineProtocol.
|
inlineoverridevirtual |
Gets the script type, for ScriptingCore, it will return cocos2d::kScriptTypeJavascript
cocos2d::kScriptTypeJavascript
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Removes the C++ object's linked JavaScript proxy object from JavaScript context.
obj | Object to be removed |
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Removes the C++ object's linked JavaScript proxy object from JavaScript context.
obj | Object to be removed |
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Removes the C++ object's linked JavaScript proxy object from JavaScript context.
obj | Object to be removed |
Reimplemented from ScriptEngineProtocol.
|
inlineoverridevirtual |
Useless in ScriptingCore, please use evalString.
Implements ScriptEngineProtocol.
|
inlineoverridevirtual |
Useless in ScriptingCore, please use evalString.
Implements ScriptEngineProtocol.
|
inlineoverridevirtual |
Useless in ScriptingCore, please use evalString.
Implements ScriptEngineProtocol.
void pauseSchedulesAndActions | ( | js_proxy_t * | p | ) |
Pause scheduled tasks and actions for an object proxy.
p | The object proxy |
var pauseSchedulesAndActions | ( | var | p | ) |
Pause scheduled tasks and actions for an object proxy.
p | The object proxy |
local pauseSchedulesAndActions | ( | local | p | ) |
Pause scheduled tasks and actions for an object proxy.
p | The object proxy |
void resumeSchedulesAndActions | ( | js_proxy_t * | p | ) |
Resume scheduled tasks and actions for an object proxy.
p | The object proxy |
var resumeSchedulesAndActions | ( | var | p | ) |
Resume scheduled tasks and actions for an object proxy.
p | The object proxy |
local resumeSchedulesAndActions | ( | local | p | ) |
Resume scheduled tasks and actions for an object proxy.
p | The object proxy |
void cleanupSchedulesAndActions | ( | js_proxy_t * | p | ) |
Cleanup scheduled tasks and actions for an object proxy.
p | The object proxy |
var cleanupSchedulesAndActions | ( | var | p | ) |
Cleanup scheduled tasks and actions for an object proxy.
p | The object proxy |
local cleanupSchedulesAndActions | ( | local | p | ) |
Cleanup scheduled tasks and actions for an object proxy.
p | The object proxy |
|
inlineoverridevirtual |
Useless in ScriptingCore, please use runScript.
filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
inlineoverridevirtual |
Useless in ScriptingCore, please use runScript.
filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
inlineoverridevirtual |
Useless in ScriptingCore, please use runScript.
filename | String object holding the filename of the script file that is to be executed |
Implements ScriptEngineProtocol.
|
overridevirtual |
Useless in ScriptingCore, please use executeFunctionWithOwner.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
|
overridevirtual |
Useless in ScriptingCore, please use executeFunctionWithOwner.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
|
overridevirtual |
Useless in ScriptingCore, please use executeFunctionWithOwner.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements ScriptEngineProtocol.
|
overridevirtual |
Parse configuration file.
type | the specific type value. |
str | the information data. |
Implements ScriptEngineProtocol.
|
overridevirtual |
Parse configuration file.
type | the specific type value. |
str | the information data. |
Implements ScriptEngineProtocol.
|
overridevirtual |
Parse configuration file.
type | the specific type value. |
str | the information data. |
Implements ScriptEngineProtocol.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
bool executeFunctionWithObjectData | ( | void * | nativeObj, |
const char * | name, | ||
JSObject * | obj | ||
) |
Execute a js function with a JavaScript object as parameter.
By passing a native object, ScriptingCore will found its JavaScript object with the proxy. Then the function will be invoked with the native object's js proxy as caller.
nativeObj | The caller object's C++ proxy. |
name | The function name. |
obj | The JavaScript object as parameter. |
var executeFunctionWithObjectData | ( | var | nativeObj, |
var | name, | ||
var | obj | ||
) |
Execute a js function with a JavaScript object as parameter.
By passing a native object, ScriptingCore will found its JavaScript object with the proxy. Then the function will be invoked with the native object's js proxy as caller.
nativeObj | The caller object's C++ proxy. |
name | The function name. |
obj | The JavaScript object as parameter. |
local executeFunctionWithObjectData | ( | local | nativeObj, |
local | name, | ||
local | obj | ||
) |
Execute a js function with a JavaScript object as parameter.
By passing a native object, ScriptingCore will found its JavaScript object with the proxy. Then the function will be invoked with the native object's js proxy as caller.
nativeObj | The caller object's C++ proxy. |
name | The function name. |
obj | The JavaScript object as parameter. |
bool executeFunctionWithOwner | ( | jsval | owner, |
const char * | name, | ||
uint32_t | argc, | ||
jsval * | vp | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
var executeFunctionWithOwner | ( | var | owner, |
var | name, | ||
var | argc, | ||
var | vp | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
local executeFunctionWithOwner | ( | local | owner, |
local | name, | ||
local | argc, | ||
local | vp | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count and arguments.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
bool executeFunctionWithOwner | ( | jsval | owner, |
const char * | name, | ||
uint32_t | argc, | ||
jsval * | vp, | ||
JS::MutableHandleValue | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
retVal | The js object to save the return value. |
var executeFunctionWithOwner | ( | var | owner, |
var | name, | ||
var | argc, | ||
var | vp, | ||
var | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
retVal | The js object to save the return value. |
local executeFunctionWithOwner | ( | local | owner, |
local | name, | ||
local | argc, | ||
local | vp, | ||
local | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments count, arguments and a return value.
owner | The caller object. |
name | The function name. |
argc | The arguments count. |
vp | The arguments. |
retVal | The js object to save the return value. |
bool executeFunctionWithOwner | ( | jsval | owner, |
const char * | name, | ||
const JS::HandleValueArray & | args | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
var executeFunctionWithOwner | ( | var | owner, |
var | name, | ||
var | args | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
local executeFunctionWithOwner | ( | local | owner, |
local | name, | ||
local | args | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
bool executeFunctionWithOwner | ( | jsval | owner, |
const char * | name, | ||
const JS::HandleValueArray & | args, | ||
JS::MutableHandleValue | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array and a return value.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
retVal | The js object to save the return value. |
var executeFunctionWithOwner | ( | var | owner, |
var | name, | ||
var | args, | ||
var | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array and a return value.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
retVal | The js object to save the return value. |
local executeFunctionWithOwner | ( | local | owner, |
local | name, | ||
local | args, | ||
local | retVal | ||
) |
Execute a js function with a JavaScript caller, function name, arguments array and a return value.
This is more reliable in js memory management
owner | The caller object. |
name | The function name. |
args | The arguments array. |
retVal | The js object to save the return value. |
void executeJSFunctionWithThisObj | ( | JS::HandleValue | thisObj, |
JS::HandleValue | callback | ||
) |
Execute a js function with a js this object and the js function object.
thisObj | The js this object. |
callback | The js function object. |
var executeJSFunctionWithThisObj | ( | var | thisObj, |
var | callback | ||
) |
Execute a js function with a js this object and the js function object.
thisObj | The js this object. |
callback | The js function object. |
local executeJSFunctionWithThisObj | ( | local | thisObj, |
local | callback | ||
) |
Execute a js function with a js this object and the js function object.
thisObj | The js this object. |
callback | The js function object. |
void executeJSFunctionWithThisObj | ( | JS::HandleValue | thisObj, |
JS::HandleValue | callback, | ||
const JS::HandleValueArray & | vp, | ||
JS::MutableHandleValue | retVal | ||
) |
Execute a js function with a js this object, the js function object, arguments and a return value.
thisObj | The js this object. |
callback | The js function object. |
vp | The arguments array. |
retVal | The js object to save the return value. |
var executeJSFunctionWithThisObj | ( | var | thisObj, |
var | callback, | ||
var | vp, | ||
var | retVal | ||
) |
Execute a js function with a js this object, the js function object, arguments and a return value.
thisObj | The js this object. |
callback | The js function object. |
vp | The arguments array. |
retVal | The js object to save the return value. |
local executeJSFunctionWithThisObj | ( | local | thisObj, |
local | callback, | ||
local | vp, | ||
local | retVal | ||
) |
Execute a js function with a js this object, the js function object, arguments and a return value.
thisObj | The js this object. |
callback | The js function object. |
vp | The arguments array. |
retVal | The js object to save the return value. |
bool evalString | ( | const char * | string, |
JS::MutableHandleValue | outVal, | ||
const char * | filename, | ||
JSContext * | cx, | ||
JS::HandleObject | global | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
filename | The filename |
cx | The js context |
global | The js global object |
var evalString | ( | var | string, |
var | outVal, | ||
var | filename, | ||
var | cx, | ||
var | global | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
filename | The filename |
cx | The js context |
global | The js global object |
local evalString | ( | local | string, |
local | outVal, | ||
local | filename, | ||
local | cx, | ||
local | global | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
filename | The filename |
cx | The js context |
global | The js global object |
bool evalString | ( | const char * | string, |
JS::MutableHandleValue | outVal | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
var evalString | ( | var | string, |
var | outVal | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
local evalString | ( | local | string, |
local | outVal | ||
) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
outVal | The jsval that will hold the return value of the evaluation. |
bool evalString | ( | const char * | string | ) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
var evalString | ( | var | string | ) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
local evalString | ( | local | string | ) |
Evaluate the specified js code string.
string | The string with the javascript code to be evaluated |
JS::PersistentRootedScript* getScript |
( | const std::string & | path | ) |
Get script object for the given path.
path | The script file path |
var getScript | ( | var | path | ) |
Get script object for the given path.
path | The script file path |
local getScript | ( | local | path | ) |
Get script object for the given path.
path | The script file path |
JS::PersistentRootedScript* compileScript |
( | const std::string & | path, |
JS::HandleObject | global, | ||
JSContext * | cx = nullptr |
||
) |
Compile the specified js file.
path | The path of the script to be compiled |
global | The js global object |
cx | The js context |
var compileScript | ( | var | path, |
var | global, | ||
var | cx = nullptr |
||
) |
Compile the specified js file.
path | The path of the script to be compiled |
global | The js global object |
cx | The js context |
local compileScript | ( | local | path, |
local | global, | ||
local | cx = nullptr |
||
) |
Compile the specified js file.
path | The path of the script to be compiled |
global | The js global object |
cx | The js context |
bool runScript | ( | const std::string & | path | ) |
Run the specified js file.
path | The path of the script to be executed |
var runScript | ( | var | path | ) |
Run the specified js file.
path | The path of the script to be executed |
local runScript | ( | local | path | ) |
Run the specified js file.
path | The path of the script to be executed |
bool runScript | ( | const std::string & | path, |
JS::HandleObject | global, | ||
JSContext * | cx = NULL |
||
) |
Run the specified js file.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
var runScript | ( | var | path, |
var | global, | ||
var | cx = NULL |
||
) |
Run the specified js file.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
local runScript | ( | local | path, |
local | global, | ||
local | cx = NULL |
||
) |
Run the specified js file.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
bool requireScript | ( | const char * | path, |
JS::MutableHandleValue | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
var requireScript | ( | var | path, |
var | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
local requireScript | ( | local | path, |
local | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
bool requireScript | ( | const char * | path, |
JS::HandleObject | global, | ||
JSContext * | cx, | ||
JS::MutableHandleValue | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
var requireScript | ( | var | path, |
var | global, | ||
var | cx, | ||
var | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
local requireScript | ( | local | path, |
local | global, | ||
local | cx, | ||
local | jsvalRet | ||
) |
Require the specified js file The difference between run and require is that require returns the export object of the script.
path | The path of the script to be executed |
global | The global object to execute the script |
global | The context to execute the script |
jsvalRet | On success, return the value from the last executed expression statement processed in the script |
void cleanScript | ( | const char * | path | ) |
Clean script object for the specified js file.
path | The path of the js file to be cleaned |
var cleanScript | ( | var | path | ) |
Clean script object for the specified js file.
path | The path of the js file to be cleaned |
local cleanScript | ( | local | path | ) |
Clean script object for the specified js file.
path | The path of the js file to be cleaned |
std::unordered_map<std::string, JS::PersistentRootedScript*> & getFileScript |
( | ) |
Gets the cached script objects for all executed js file.
var getFileScript | ( | ) |
Gets the cached script objects for all executed js file.
local getFileScript | ( | ) |
Gets the cached script objects for all executed js file.
void addRegisterCallback | ( | sc_register_sth | callback | ) |
Add the register_sth callback to the list of functions that need to be called after the creation of the context.
It's normally used to register script bindings in the js context for bound classes
callback | The callback to register something to the js context |
var addRegisterCallback | ( | var | callback | ) |
Add the register_sth callback to the list of functions that need to be called after the creation of the context.
It's normally used to register script bindings in the js context for bound classes
callback | The callback to register something to the js context |
local addRegisterCallback | ( | local | callback | ) |
Add the register_sth callback to the list of functions that need to be called after the creation of the context.
It's normally used to register script bindings in the js context for bound classes
callback | The callback to register something to the js context |
void createGlobalContext | ( | ) |
Create a new context.
If one is already there, it will destroy the old context and create a new one.
var createGlobalContext | ( | ) |
Create a new context.
If one is already there, it will destroy the old context and create a new one.
local createGlobalContext | ( | ) |
Create a new context.
If one is already there, it will destroy the old context and create a new one.
|
static |
Removes all rooted object in the given js context, rooted object won't be garbage collected.
cx | The js context |
|
static |
Removes all rooted object in the given js context, rooted object won't be garbage collected.
cx | The js context |
|
static |
Removes all rooted object in the given js context, rooted object won't be garbage collected.
cx | The js context |
int executeCustomTouchEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
cocos2d::Touch * | pTouch, | ||
JSObject * | obj, | ||
JS::MutableHandleValue | retval | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
retval | The return value of the touch event callback |
var executeCustomTouchEvent | ( | var | eventType, |
var | pTouch, | ||
var | obj, | ||
var | retval | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
retval | The return value of the touch event callback |
local executeCustomTouchEvent | ( | local | eventType, |
local | pTouch, | ||
local | obj, | ||
local | retval | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
retval | The return value of the touch event callback |
int executeCustomTouchEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
cocos2d::Touch * | pTouch, | ||
JSObject * | obj | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
var executeCustomTouchEvent | ( | var | eventType, |
var | pTouch, | ||
var | obj | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
local executeCustomTouchEvent | ( | local | eventType, |
local | pTouch, | ||
local | obj | ||
) |
Simulate a touch event and dispatch it to a js object.
eventType | The touch event type |
pTouch | The touch object |
obj | The js object |
int executeCustomTouchesEvent | ( | cocos2d::EventTouch::EventCode | eventType, |
const std::vector< cocos2d::Touch * > & | touches, | ||
JSObject * | obj | ||
) |
Simulate a multi touch event and dispatch it to a js object.
eventType | The touch event type |
touches | Touches list for multitouch |
obj | The js object |
var executeCustomTouchesEvent | ( | var | eventType, |
var | touches, | ||
var | obj | ||
) |
Simulate a multi touch event and dispatch it to a js object.
eventType | The touch event type |
touches | Touches list for multitouch |
obj | The js object |
local executeCustomTouchesEvent | ( | local | eventType, |
local | touches, | ||
local | obj | ||
) |
Simulate a multi touch event and dispatch it to a js object.
eventType | The touch event type |
touches | Touches list for multitouch |
obj | The js object |
|
inline |
Gets the current global context.
|
inline |
Gets the current global context.
|
inline |
Gets the current global context.
|
static |
Report an error in the js context.
cx | The js context |
message | The error message |
report | The js error report object |
|
static |
Report an error in the js context.
cx | The js context |
message | The error message |
report | The js error report object |
|
static |
Report an error in the js context.
cx | The js context |
message | The error message |
report | The js error report object |
|
static |
Log something to the js context using CCLog.
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Log something to the js context using CCLog.
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Log something to the js context using CCLog.
cx | The js context |
argc | The arguments count |
vp | The arguments |
bool setReservedSpot | ( | uint32_t | i, |
JSObject * | obj, | ||
jsval | value | ||
) |
Sets a js value to the targeted js object's reserved slot, which is not exposed to script environment.
i | The slot index |
obj | The targeted object |
value | The js value to set to the slot |
var setReservedSpot | ( | var | i, |
var | obj, | ||
var | value | ||
) |
Sets a js value to the targeted js object's reserved slot, which is not exposed to script environment.
i | The slot index |
obj | The targeted object |
value | The js value to set to the slot |
local setReservedSpot | ( | local | i, |
local | obj, | ||
local | value | ||
) |
Sets a js value to the targeted js object's reserved slot, which is not exposed to script environment.
i | The slot index |
obj | The targeted object |
value | The js value to set to the slot |
|
static |
Runs a script from script environment, it should be invoked from script environment Bound to __jsc__.executeScript
and window.executeScript
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Runs a script from script environment, it should be invoked from script environment Bound to __jsc__.executeScript
and window.executeScript
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Runs a script from script environment, it should be invoked from script environment Bound to __jsc__.executeScript
and window.executeScript
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Forces a cycle of garbage collection, it should be invoked from script environment Bound to __jsc__.garbageCollect
and window.garbageCollect
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Forces a cycle of garbage collection, it should be invoked from script environment Bound to __jsc__.garbageCollect
and window.garbageCollect
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Forces a cycle of garbage collection, it should be invoked from script environment Bound to __jsc__.garbageCollect
and window.garbageCollect
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Dump all named rooted objects, it should be invoked from script environment Bound to __jsc__.dumpRoot
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Dump all named rooted objects, it should be invoked from script environment Bound to __jsc__.dumpRoot
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Dump all named rooted objects, it should be invoked from script environment Bound to __jsc__.dumpRoot
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Check whether a js object's C++ proxy is still valid, it should be invoked from script environment Bound to window.__isObjectValid
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Check whether a js object's C++ proxy is still valid, it should be invoked from script environment Bound to window.__isObjectValid
cx | The js context |
argc | The arguments count |
vp | The arguments |
|
static |
Check whether a js object's C++ proxy is still valid, it should be invoked from script environment Bound to window.__isObjectValid
cx | The js context |
argc | The arguments count |
vp | The arguments |
void debugProcessInput | ( | const std::string & | str | ) |
Log a string to the debug environment.
Enable the debug environment so that it can be invoked.
str | The message to log |
var debugProcessInput | ( | var | str | ) |
Log a string to the debug environment.
Enable the debug environment so that it can be invoked.
str | The message to log |
local debugProcessInput | ( | local | str | ) |
Log a string to the debug environment.
Enable the debug environment so that it can be invoked.
str | The message to log |
void enableDebugger | ( | unsigned int | port = 5086 | ) |
Enable the debug environment, mozilla Firefox's remote debugger or Code IDE can connect to it.
port | The port to connect with the debug environment, default value is 5086 |
var enableDebugger | ( | var | port = 5086 | ) |
Enable the debug environment, mozilla Firefox's remote debugger or Code IDE can connect to it.
port | The port to connect with the debug environment, default value is 5086 |
local enableDebugger | ( | local | port = 5086 | ) |
Enable the debug environment, mozilla Firefox's remote debugger or Code IDE can connect to it.
port | The port to connect with the debug environment, default value is 5086 |
|
inline |
Gets the debug environment's global object.
|
inline |
Gets the debug environment's global object.
|
inline |
Gets the debug environment's global object.
|
inline |
Gets the global object.
|
inline |
Gets the global object.
|
inline |
Gets the global object.
bool isFunctionOverridedInJS | ( | JS::HandleObject | obj, |
const std::string & | name, | ||
JSNative | native | ||
) |
Checks whether a C++ function is overridden in js prototype chain.
obj | The js object |
name | The function name |
native | The native function |
var isFunctionOverridedInJS | ( | var | obj, |
var | name, | ||
var | native | ||
) |
Checks whether a C++ function is overridden in js prototype chain.
obj | The js object |
name | The function name |
native | The native function |
local isFunctionOverridedInJS | ( | local | obj, |
local | name, | ||
local | native | ||
) |
Checks whether a C++ function is overridden in js prototype chain.
obj | The js object |
name | The function name |
native | The native function |
|
overridevirtual |
Roots the associated JSObj.
The GC won't collected rooted objects. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Roots the associated JSObj.
The GC won't collected rooted objects. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Roots the associated JSObj.
The GC won't collected rooted objects. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Unroots the associated JSObj.
The GC will collect this object the next time the GC is called. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Unroots the associated JSObj.
The GC will collect this object the next time the GC is called. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
|
overridevirtual |
Unroots the associated JSObj.
The GC will collect this object the next time the GC is called. This function is only called when compiled with CC_ENABLE_GC_FOR_NATIVE_OBJECTS=1
Reimplemented from ScriptEngineProtocol.
void jsb_ref_autoreleased_init | ( | JSContext * | cx, |
JS::Heap< JSObject * > * | obj, | ||
cocos2d::Ref * | ref, | ||
const char * | debug | ||
) |
Generic initialization function for subclasses of Ref.
Similar to jsb_ref_init(), but call it if you know that Ref has been autoreleased This function should never be called. It is only added as way to fix an issue with the static auto-bindings with the "create" function
var jsb_ref_autoreleased_init | ( | var | cx, |
var | obj, | ||
var | ref, | ||
var | debug | ||
) |
Generic initialization function for subclasses of Ref.
Similar to jsb_ref_init(), but call it if you know that Ref has been autoreleased This function should never be called. It is only added as way to fix an issue with the static auto-bindings with the "create" function
local jsb_ref_autoreleased_init | ( | local | cx, |
local | obj, | ||
local | ref, | ||
local | debug | ||
) |
Generic initialization function for subclasses of Ref.
Similar to jsb_ref_init(), but call it if you know that Ref has been autoreleased This function should never be called. It is only added as way to fix an issue with the static auto-bindings with the "create" function
void jsb_ref_rebind | ( | JSContext * | cx, |
JS::HandleObject | jsobj, | ||
js_proxy_t * | js2native_proxy, | ||
cocos2d::Ref * | oldRef, | ||
cocos2d::Ref * | newRef, | ||
const char * | debug | ||
) |
Disassociates oldRef from jsobj, and associates a new Ref.
Useful for the EaseActions and others
var jsb_ref_rebind | ( | var | cx, |
var | jsobj, | ||
var | js2native_proxy, | ||
var | oldRef, | ||
var | newRef, | ||
var | debug | ||
) |
Disassociates oldRef from jsobj, and associates a new Ref.
Useful for the EaseActions and others
local jsb_ref_rebind | ( | local | cx, |
local | jsobj, | ||
local | js2native_proxy, | ||
local | oldRef, | ||
local | newRef, | ||
local | debug | ||
) |
Disassociates oldRef from jsobj, and associates a new Ref.
Useful for the EaseActions and others
JSObject* jsb_ref_autoreleased_create_jsobject |
( | JSContext * | cx, |
cocos2d::Ref * | ref, | ||
js_type_class_t * | typeClass, | ||
const char * | debug | ||
) |
Creates a new JSObject of a certain type (typeClass) and creates a proxy associated with and the Ref Similar to jsb_ref_create_jsobject(), but call it if you know that Ref has been autoreleased This function should never be called.
It is only added as way to fix an issue with the static auto-bindings with the "create" function
var jsb_ref_autoreleased_create_jsobject |
( | var | cx, |
var | ref, | ||
var | typeClass, | ||
var | debug | ||
) |
Creates a new JSObject of a certain type (typeClass) and creates a proxy associated with and the Ref Similar to jsb_ref_create_jsobject(), but call it if you know that Ref has been autoreleased This function should never be called.
It is only added as way to fix an issue with the static auto-bindings with the "create" function
local jsb_ref_autoreleased_create_jsobject |
( | local | cx, |
local | ref, | ||
local | typeClass, | ||
local | debug | ||
) |
Creates a new JSObject of a certain type (typeClass) and creates a proxy associated with and the Ref Similar to jsb_ref_create_jsobject(), but call it if you know that Ref has been autoreleased This function should never be called.
It is only added as way to fix an issue with the static auto-bindings with the "create" function
JSObject* jsb_create_weak_jsobject | ( | JSContext * | cx, |
void * | native, | ||
js_type_class_t * | typeClass, | ||
const char * | debug | ||
) |
It will try to get the associated JSObjct for the native object.
The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.
var jsb_create_weak_jsobject | ( | var | cx, |
var | native, | ||
var | typeClass, | ||
var | debug | ||
) |
It will try to get the associated JSObjct for the native object.
The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.
local jsb_create_weak_jsobject | ( | local | cx, |
local | native, | ||
local | typeClass, | ||
local | debug | ||
) |
It will try to get the associated JSObjct for the native object.
The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.
JSObject* jsb_ref_get_or_create_jsobject |
( | JSContext * | cx, |
cocos2d::Ref * | ref, | ||
js_type_class_t * | typeClass, | ||
const char * | debug | ||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref. Call this function for objects that were already created and initialized, when returning getChild()
var jsb_ref_get_or_create_jsobject | ( | var | cx, |
var | ref, | ||
var | typeClass, | ||
var | debug | ||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref. Call this function for objects that were already created and initialized, when returning getChild()
local jsb_ref_get_or_create_jsobject |
( | local | cx, |
local | ref, | ||
local | typeClass, | ||
local | debug | ||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref. Call this function for objects that were already created and initialized, when returning getChild()
JSObject* jsb_ref_autoreleased_get_or_create_jsobject |
( | JSContext * | cx, |
cocos2d::Ref * | ref, | ||
js_type_class_t * | typeClass, | ||
const char * | debug = nullptr |
||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref Call this function for objects that might return an already existing copy when you create them. For example, Animation3D::create()
;
var jsb_ref_autoreleased_get_or_create_jsobject |
( | var | cx, |
var | ref, | ||
var | typeClass, | ||
var | debug = nullptr |
||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref Call this function for objects that might return an already existing copy when you create them. For example, Animation3D::create()
;
local jsb_ref_autoreleased_get_or_create_jsobject |
( | local | cx, |
local | ref, | ||
local | typeClass, | ||
local | debug = nullptr |
||
) |
It will try to get the associated JSObjct for ref.
If it can't find it, it will create a new one associating it to Ref Call this function for objects that might return an already existing copy when you create them. For example, Animation3D::create()
;
CC_JS_DLL JSObject* jsb_get_or_create_weak_jsobject |
( | JSContext * | cx, |
void * | native, | ||
js_type_class_t * | typeClass, | ||
const char * | debug = nullptr |
||
) |
It will try to get the associated JSObjct for the native object.
If it can't find it, it will create a new one associating it to the native object. The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_get_or_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.
var jsb_get_or_create_weak_jsobject | ( | var | cx, |
var | native, | ||
var | typeClass, | ||
var | debug = nullptr |
||
) |
It will try to get the associated JSObjct for the native object.
If it can't find it, it will create a new one associating it to the native object. The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_get_or_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.
local jsb_get_or_create_weak_jsobject |
( | local | cx, |
local | native, | ||
local | typeClass, | ||
local | debug = nullptr |
||
) |
It will try to get the associated JSObjct for the native object.
If it can't find it, it will create a new one associating it to the native object. The reference created from JSObject to native object is weak because it won't retain it. The behavior is exactly the same with 'jsb_ref_get_or_create_jsobject' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated.