|
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.
|
|