Closed Ambrevar closed 3 years ago
I don't know much about WebKit and its API, but my guess is that JSCValue
is not a part of Webkit but JavaScriptCore. Probably you need to load it also.
Good point. I've added
(defvar javascript (gir:ffi "JavaScriptCore"))
but the result is still nil.
I'm realizing something: js-result (the result of run-javascript-finish) is a struct instance, so I guess I cannot call
(gir:invoke (js-result 'get-js-value))
because get-js-value
is not a method and js-result
is not an object.
Is this correct? If so, should GIR throw a warning/error?
What are the recommended ways to introspect objects and repositories?
For instance:
What are the recommended ways to introspect objects and repositories? For instance: - List all repository functions / objects / methods. - Show the type / repository of an object / struct. - List the methods of an object.
@andy128k ?
The only way I've been able to figure out thus far is:
(gir:nget *gtk* "Window" 'new)
and then inspecting the object via SLIME
Examples of inspection of a repository can be found in test files.
Thank you for the information!
So, it was a bug which was fixed in #82.
Fantastic! @jmercouris: Can you try and see if you can get the JavaScript result now?
@Ambrevar @jmercouris I tested it already and it works as expected. *result*
variable receives an object of type JSCValue
. So, to get a text a call (gir:invoke (*result*) 'to_string)
should be added.
I'm trying to run some javascript in a webview. To do this, I'm essentially implemented a simplified version of the example in the documentation: https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-run-javascript-finish.
Full example:
Compile, switch to this package and call
(main)
). It should show a window with a webview. Pressingg
should call thedocument.title;
javascript. Sadly,*result*
remains nil after the call, while I'd expect a JSCValue.Any idea? And thanks for all the precious help you've given me so far :)