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.
-
#bind_typed(name : String, t1 : T1.class, t2 : T2.class, t3 : T3.class, &block : T1, T2, T3 -> R) forall T1, T2, T3, R
Type-safe binding for 3 parameters
-
#bind_typed(name : String, t1 : T1.class, t2 : T2.class, &block : T1, T2 -> R) forall T1, T2, R
Type-safe binding for 2 parameters
-
#bind_typed(name : String, t1 : T1.class, &block : T1 -> R) forall T1, R
Type-safe binding for 1 parameter
-
#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.
-
#eval_async(js : String, &callback : -> )
Evaluates JavaScript asynchronously with a callback
-
#eval_with_channel(js : String) : Channel(Nil)
Evaluates JavaScript and returns result via a channel (fiber-friendly)
-
#html=(html : String)
Set WebView HTML directly
-
#init(js : String)
injects Javascript code at the initialization of the new page.
-
#native_handle(kind : NativeHandleKind)
Get a native handle of choice (window, widget, or browser controller)
-
#navigate(url)
navigates WebView to the given URL.
-
#on_load : Proc(Nil) | Nil
Lifecycle event callbacks
-
#on_load=(on_load : Proc(Nil) | Nil)
Lifecycle event callbacks
- #on_navigate : Proc(String, Nil) | Nil
- #on_navigate=(on_navigate : Proc(String, Nil) | Nil)
-
#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.
Type-safe binding for 3 parameters
Type-safe binding for 2 parameters
Type-safe binding for 1 parameter
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.
Evaluates JavaScript and returns result via a channel (fiber-friendly)
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.
Get a native handle of choice (window, widget, or browser controller)
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.