![]() |
![]() |
![]() |
libgebr Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
JSValueRef gebr_js_eval_with_url (JSContextRef ctx
,const gchar *script
,const gchar *url
); JSValueRef gebr_js_evaluate (JSContextRef ctx
,const gchar *script
); JSValueRef gebr_js_evaluate_file (JSContextRef ctx
,const gchar *file
); gchar * gebr_js_value_to_string (JSContextRef ctx
,JSValueRef value
); GString * gebr_js_value_get_string (JSContextRef ctx
,JSValueRef val
); gboolean gebr_js_value_get_boolean (JSContextRef ctx
,JSValueRef val
); JSObjectRef gebr_js_make_function (JSContextRef ctx
,const gchar *name
,JSObjectCallAsFunctionCallback callback
); gboolean gebr_js_include (JSContextRef ctx
,const gchar *file
);
JSValueRef gebr_js_eval_with_url (JSContextRef ctx
,const gchar *script
,const gchar *url
);
Evaluates script
at the given url
.
|
A JSContextRef, from a WebKitWebView for example. |
|
The JavaScript script to be evaluated. |
|
The address associated with this script evaluation. |
Returns : |
a JSValueRef containing the return value of the evaluated script. |
JSValueRef gebr_js_evaluate (JSContextRef ctx
,const gchar *script
);
Evaluates the JavaScript given by script
.
|
A JSContextRef, from a WebKitWebView for example. |
|
The JavaScript script to be evaluated. |
Returns : |
a JSValueRef containing the return value of the evaluated script. |
JSValueRef gebr_js_evaluate_file (JSContextRef ctx
,const gchar *file
);
Evaluates the JavaScript file given by file
.
|
A JSContextRef, from a WebKitWebView for example. |
|
A system file path, pointing to the JavaScript file. |
Returns : |
a JSValueRef containing the return value of the evaluated script. |
gchar * gebr_js_value_to_string (JSContextRef ctx
,JSValueRef value
);
This function returns the string representation of value
. It is the same as calling the 'toString' method in
JavaScript.
Applying this function into a JSValueRef that is a JavaScript String will return the string itself. But
you should not trust this behavior. Use gebr_js_value_get_string()
for this purpose instead.
|
A JSContextRef, from a WebKitWebView for example. |
|
The value to get the string representation. |
Returns : |
A newly allocated string representing value . |
GString * gebr_js_value_get_string (JSContextRef ctx
,JSValueRef val
);
Gets the string value of val
and returns it as a GString.
|
A JSContextRef, from a WebKitWebView for example. |
|
The value to get the string value. |
Returns : |
A GString containing the string value of val . |
gboolean gebr_js_value_get_boolean (JSContextRef ctx
,JSValueRef val
);
Gets the boolean value from the JSValueRef, val
.
|
A JSContextRef, from a WebKitWebView for example. |
|
The JavaScript value to get the boolean value. |
Returns : |
A gboolean containing the value of val . |
JSObjectRef gebr_js_make_function (JSContextRef ctx
,const gchar *name
,JSObjectCallAsFunctionCallback callback
);
Creates a JavaScript function in context ctx
which calls callback
.
|
The JavaScript function name to be created. |
|
A c-function which will be called upon JavaScript's function call. |
Returns : |
A JavaScript object representing the function. |
gboolean gebr_js_include (JSContextRef ctx
,const gchar *file
);
Includes a JavaScript file into a context by appending a lt
;scriptgt
; tag into
document.body. You must guarantee body tag exists, otherwise this function may fail silently.
This might be done by connecting to "load-finished" signal of WebKitWebView.
|
A JavaScript context to have file included. |
|
The path of the JavaScript file to be included. |
Returns : |
TRUE if file exists, FALSE otherwise. |