mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Factor the initialisation of smjs_elinks_global out of init_smjs and
into the new smjs_init_elinks_object.
This commit is contained in:
parent
60dd7515f9
commit
8743ec74d8
@ -112,7 +112,7 @@ init_smjs(struct module *module)
|
|||||||
|
|
||||||
smjs_init_global_object();
|
smjs_init_global_object();
|
||||||
|
|
||||||
smjs_elinks_object = smjs_get_elinks_object();
|
smjs_init_elinks_object();
|
||||||
|
|
||||||
smjs_load_hooks();
|
smjs_load_hooks();
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ static const JSFunctionSpec elinks_funcs[] = {
|
|||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
JSObject *
|
static JSObject *
|
||||||
smjs_get_elinks_object(void)
|
smjs_get_elinks_object(void)
|
||||||
{
|
{
|
||||||
assert(smjs_ctx);
|
assert(smjs_ctx);
|
||||||
@ -56,6 +56,12 @@ smjs_get_elinks_object(void)
|
|||||||
(JSFunctionSpec *) elinks_funcs, NULL, NULL);
|
(JSFunctionSpec *) elinks_funcs, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
smjs_init_elinks_object(void)
|
||||||
|
{
|
||||||
|
smjs_elinks_object = smjs_get_elinks_object();
|
||||||
|
}
|
||||||
|
|
||||||
/* If elinks.<method> is defined, call it with the given arguments,
|
/* If elinks.<method> is defined, call it with the given arguments,
|
||||||
* store the return value in rval, and return JS_TRUE. Else return JS_FALSE. */
|
* store the return value in rval, and return JS_TRUE. Else return JS_FALSE. */
|
||||||
JSBool
|
JSBool
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
#include "ecmascript/spidermonkey/util.h"
|
#include "ecmascript/spidermonkey/util.h"
|
||||||
|
|
||||||
JSObject *smjs_get_elinks_object(void);
|
/* Initialise elinks_object. */
|
||||||
|
void smjs_init_elinks_object(void);
|
||||||
|
|
||||||
|
/* Invoke elinks.<method> with the given arguments and put the return value
|
||||||
|
* into *rval. */
|
||||||
JSBool smjs_invoke_elinks_object_method(unsigned char *method,
|
JSBool smjs_invoke_elinks_object_method(unsigned char *method,
|
||||||
jsval argv[], int argc, jsval *rval);
|
jsval argv[], int argc, jsval *rval);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user