class Webview::Webview
- Webview::Webview
- Reference
- Object
Defined in:
webview.crConstructors
Instance Method Summary
-
#bind(name : String, fn : JSProc)
binds a callback function so that it will appear under the given name as a global Javascript function.
-
#destroy
destroys a WebView and closes the native window.
-
#dispatch(&f : -> )
posts a function to be executed on the main thread.
-
#eval(js : String)
evaluates arbitrary Javascript code.
-
#html=(html : String)
Set WebView HTML directly
-
#init(js : String)
injects Javascript code at the initialization of the new page.
-
#navigate(url)
navigates WebView to the given URL.
-
#run
runs the main loop until it's terminated.
- #size(width, height, hint : SizeHints)
-
#terminate
Terminate stops the main loop.
- #title=(val)
-
#unbind(name : String)
Removes a native Crystal callback that was previously set by
#bind
. -
#window
returns a native window handle pointer.
Constructor Detail
Instance Method Detail
binds a callback function so that it will appear under the given name as a global Javascript function.
posts a function to be executed on the main thread. You normally do no need to call this function, unless you want to tweak the native window.
evaluates arbitrary Javascript code. Evaluation happens asynchronously, also the result of the expression is ignored. Use RPC bindings if you want to receive notifications about the result of the evaluation.
injects Javascript code at the initialization of the new page. Every time the WebView will open the new page - this initialization code will be executed. It is guaranteed that code is executed before window.onload.
runs the main loop until it's terminated. After this function exists you must destroy the WebView
Terminate stops the main loop. It is safe to call this function from a background thread.
returns a native window handle pointer. When using GTK backend the pointer is GtkWindow pointer, when using Cocoa backend the pointer is NSWindow pointer, when using Win32 backend the pointer is HWND pointer.