SynopsisDefine a JavaScript global function. Prototype#include "ej.h" int ejSetGlobalFunction(int eid, char_t *name, int (*fn)(int eid, void *handle, int argc, char_t **argv)); Parameters
DescriptionThe ejSetGlobalFunction procedure defines a JavaScript function. When the function named by name is called, the function defined by fn is called.
When fn is called, the JavaScript parameters are passed in via argc and argv as a list of pointers to arguments. Use ejArgs to parse the arguments array. Return ValueReturns 0 if successful. Returns -1 on errors. Examplechar_t *emsg; int fn(int eid, void *handle, int argc, char_t **argv); ejSetGlobalFunction(int eid, "myfunc", myfunc); See Also |